This is the SAS macro code my professor has used in one of his examples:
%MACRO logistic_aic_sbc_score(yvariable=,xvariables=,dataset=,minvar=,maxvar=);
proc datasets;
delete allaicsbc;
run;
%LET nmodels=&maxvar-&minvar+1;
%DO i= 1 %to &nmodels;
proc datasets;
delete aicsbc model_reg_logistic temp ;
run;
proc logistic data=&dataset ;
model &yvariable(ref='0') = &xvariables / selection=score best=1 start=&minvar stop=&maxvar;
ods output stat.Logistic.BestSubsets=model_reg_logistic;
run;
data model_reg_logistic; set model_reg_logistic;
keep VariablesInModel;
run;
data temp; set model_reg_logistic;
if _N_ NE &i then delete;
run;
data _null_ ;
set temp;
call symputx('xvar',VariablesInModel);
run;
proc logistic data=&dataset ;
model &yvariable(ref='0') = &xvar;
ods output Stat.Logistic.FitStatistics=aicsbc;
run;
data aicsbc;set aicsbc;
drop InterceptOnly;
if criterion ="-2 Log L" then delete;
run;
proc transpose data=aicsbc out=aicsbc;
run;
data aicsbc;set aicsbc;
rename COL1=AIC COL2=SBC;
run;
data aicsbc;set aicsbc;
keep AIC SBC;
run;
proc append base=allaicsbc data=aicsbc force;
run;
%END;
data allaicsbc;
merge allaicsbc model_reg_logistic;
run;
proc print data=allaicsbc;
run;
%MEND logistic_aic_sbc_score;
and I would like to create a table for a file named pred3_num, here is the all subset search code for it:
proc logistic data=pred3_num;
class x5 x7 x8;
model y(ref='0') = x1 x2 x21 x22 x23 x24 x25 x26 x27 x28 x29 xx2 x3 x31 x4 x41 x42 x5-x8 x9 x91 x10 x11 x111 x112 x113 x114 x115 x116 x117 x118 x119 xx11 x12-x14
x15 x151 x152 /
selection=score best=1;
run;
there 42 explanatory variables. I would like to know how I can modify that MACRO code in order to create a table for my pred3_num data set.
Thank you