我想为我的数据集的一个子集创建一个本地宏,用于将来的回归(Some Uses for Macros Outside of Loops部分)。我已经开始了与代码,沿线为这样:Stata:用于观察子集的本地宏
quietly reg y x1 x2 x3
local subset if e(sample)
list Unit `subset'
reg y x1 x2 if `subset'
有缺失值,所以一些意见被排除在第一reg
命令。 list
命令的输出确实表明宏的内容确实是我想要的(Unit
是标识观察值的变量)。但是,我收到最后一条命令后的错误消息。
if not found
r(111);
从上r(111)
的信息:
__________ not found;
no variables defined;
The variable does not exist. You may have mistyped the variable's name.
什么是错我的语法(即,为什么它是治疗if
作为一个变量)?
伟大的思想家一样 –
就像没有版主看起来这些评论。 –