如何在Stata中以列表形式获取观察结果? [英] How to get observations as a list in Stata?

查看:82
本文介绍了如何在Stata中以列表形式获取观察结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Stata 有 r() 宏用于某些命令返回的值(命令后的返回列表).

Stata has r() macro for values that some commands return (return list after the command).

我需要在 list x if y == 1 之后对 x 进行类似的访问,但是 list 只返回 r(N),而不是值本身.

I need similar access to x after list x if y == 1, but list returns only r(N), not values themselves.

是否可以将观察结果作为局部或全局宏在代码中引用?

Is it possible to get the observations as a local or global macro to refer to it in the code?

推荐答案

尝试 levelsof 命令以获得不同的值.这是猫的睡衣.

Try levelsof command to get distinct values. It's the cat's pajamas.

这篇关于如何在Stata中以列表形式获取观察结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆