我正在使用以下代码进行回归宏:
%Macro Regression;
%let index = 1;
%do %until (%Scan(&Var2,&index," ")=);
%let Ind = %Scan(&Var2,&index," ");
ods output SelectionSummary = SelectionSummary;
proc reg data = Regression2 plots = none;
model &Ind = &var / selection = stepwise maxstep=1;
output out = summary R = RSQUARE;
run;
quit;
%if &index = 1 %then %do;
data final;
set selectionsummary;
run;
%end;
%else %do;
data final;
set final selectionsummary;
run;
%end;
%let index = %eval(&Index + 1);
%end;
%mend;
%Regression;
这段代码有效,并给了我一个表格,突出显示了解释因变量的最大变化的自变量。
我正在寻找一种方法来运行它,但回归给了我三个最好的自变量来解释因变量,如果它被选为第一个变量,例如:
选择的型号:
GDP = Human Capital
GDP = Working Capital
GDP = Growth
DependentVar Ind1 Ind2 Ind3 Rsq1 Rsq2 Rsq3
GDP human capital working capital growth 0.76 0.75 0.69
或者
DependentVar Independent1 Rsq
GDP human capital 0.76
GDP working capital 0.75
GDP growth 0.69
编辑:
如果有办法逐步设置 maxstep = 3 并为每个因变量提供最佳的三个自变量组合,条件是第一个自变量是唯一的,那将是绝对的好处。
TIA。