我想爲我的數據集的一個子集創建一個本地宏,用於將來的迴歸(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
作爲一個變量)?
偉大的思想家一樣 –
就像沒有版主看起來這些評論。 –