If I don't specify the SLENTRY and SLSTAY options in code below, what's the backward selection default stopping rule in SAS?
proc logistic data = dataset;
model Y(event='1')=X /selection = backward;
run;
Hello @Xixi97 and welcome to the SAS Support Communities!
According to the documentation the default criterion is SLSTAY=0.05.
Let's check this:
/* Create sample data for demonstration */
data test;
input g r v n;
cards;
1 0 0 10000
1 0 1 10000
1 1 0 10000
1 1 1 10398
2 0 0 10000
2 0 1 10000
2 1 0 10000
2 1 1 10397
;
/* Fit the full model by group (g) for response r=1 with predictor v */
ods output parameterestimates=est;
proc logistic data=test desc;
by g;
freq n;
model r=v;
run;
proc print data=est;
run;
Result:
Prob Obs g Variable DF Estimate StdErr WaldChiSq ChiSq _ESTTYPE_ 1 1 Intercept 1 -1.28E-6 0.0141 0.0000 0.9999 MLE 2 1 v 1 0.0390 0.0199 3.8446 0.0499 MLE 3 2 Intercept 1 -1.27E-6 0.0141 0.0000 0.9999 MLE 4 2 v 1 0.0389 0.0199 3.8256 0.0505 MLE
/* Use backward elimination with the default SLSTAY=0.05 */
ods output parameterestimates=estb;
proc logistic data=test desc;
by g;
freq n;
model r=v / selection=backward;
run;
proc print data=estb;
run;
Result:
Prob Obs g Variable DF Estimate StdErr WaldChiSq ChiSq _ESTTYPE_ 1 1 Intercept 1 -1.28E-6 0.0141 0.0000 0.9999 MLE 2 1 v 1 0.0390 0.0199 3.8446 0.0499 MLE 3 2 Intercept 1 0.0197 0.00995 3.9014 0.0482 MLE
As expected, only in group g=1 variable v met the selection criterion "ProbChiSq<=SLSTAY=0.05" and thus made it into the final model.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.