简体   繁体   English

SAS:如何为300多个外生变量修改Proc模型

[英]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个时间假人tdum1tdum390 ,如何避免写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.

相关问题 SAS PROC LOGISTIC-为什么拟合优度检验拒绝模型? - SAS PROC LOGISTIC - why is Goodness of Fit test rejecting model? 如何通过SAS中的PROC LOGISTIC和PROC REG读取相关矩阵output? - How to read the correlation matrix output by PROC LOGISTIC and PROC REG in SAS? 对于我的外生变量的所有可能组合,是否有 R function 适合 ARIMAX model? - Is there an R function to fit an ARIMAX model for all possible combinations of my exogenous variables? statsmodel 时间序列分析 - 使用 AR model 具有不同的内生和外生变量之间的滞后 - statsmodel time series analysis - using AR model with differing lags between endogenous and exogenous variables SAS proc ttest或proc混合 - SAS proc ttest or proc mixed 如何在SAS中创建宏以在大数据集中重复PROC MIXED - How to create a macro in SAS to repeat PROC MIXED in a large data set Kmeans和SAS:proc fastclus如何获得出口,收敛和严格 - Kmeans and SAS: proc fastclus how to get outseed, converge and strict 如何使用SAS proc sql计算权重的中位数? - How to calculated median with weights using SAS proc sql? 如何在proc混合(SAS)中获得单个估计值(斜率/截距) - How to obtain individual estimates (slopes/intercepts) in proc mixed (SAS) 在 SAS 中,有没有一种方法可以仅使用 proc 来计算两个分类变量之间的“规范相关”? - In SAS is there a way to compute the “canonical correlation” between two categorical variables using just a proc?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM