[英]SAS: How to modify Proc Model for over 300 exogenous variables
I have to run a Newey-West regression with over 300 exogenous variables (due to multiple lags and time dummy variables). 我必须使用300多个外生变量运行Newey-West回归(由于存在多个滞后和时间虚拟变量)。 This is the typical way to run a SAS Newey-West regression: 这是运行SAS Newey-West回归的典型方法:
proc model data=two;
endo r_invest;
exog r_int r_gnp;
instruments _exog_;
parms b0 b1 b2;
r_invest=b0 + b1*r_int + b2*r_gnp;
fit r_invest / gmm kernel=(bart,5,0) vardef=n;
run;
quit;
Say that I have 390 time dummy called tdum1
to tdum390
, how can I avoid to write r_invest=b0 + b1*r_int + b2*r_gnp +b3*tdum1....b390*tdum390;
假设我有390个时间假人tdum1
到tdum390
,如何避免写r_invest=b0 + b1*r_int + b2*r_gnp +b3*tdum1....b390*tdum390;
? ?
I'm not sure of the exact syntax of this procedure, but this macro will write out the variables you have listed in the comments below your code. 我不确定此过程的确切语法,但是此宏将写出您在代码下方的注释中列出的变量。 You can edit it to fit the exact syntax you need. 您可以对其进行编辑以适合所需的确切语法。
%macro writeOutMyVars();
%do i=1 %to 390;
+ b%eval(&i+2)*tdum&i
%end;
%mend;
proc model data=two;
endo r_invest;
exog r_int r_gnp;
instruments _exog_;
parms b0 b1 b2;
r_invest=b0 + b1*r_int + b2*r_gnp %writeOutMyVars(); ;
fit r_invest / gmm kernel=(bart,5,0) vardef=n;
run;
quit;
If you add "options mprint;" 如果添加“ options mprint;” to the top of your code then the macro output will be written to the log so you can see what it is doing. 在代码顶部,然后将宏输出写入日志,以便您查看其操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.