data sat; infile '../data/case1201.txt'; input state $ sat takers income years public expend rank; ltakers = log(takers); proc reg; model sat = ltakers income years public expend rank /selection = cp AIC sbc best = 10; /* the options above ask SAS to: */ /* selection = cp: look at all subsets of variables, report those with small cp */ /* best = 10: report only the 10 best models */ /* aic: calculate the AIC value for each of the 10 models */ /* sbc: calculate Schwartz' BIC for each model */ /* (confusing names: the BIC option computes a different statistic */ /* you want what SAS calls SBC */ title 'Cp model selection'; /* you could add an output statement here to get predicted values */ /* residuals, cooks distance, or any other statistic for each obs. */ proc reg aic sbc; model sat = ltakers income years public expend rank / selection = stepwise sle = 0.25 sls = 0.25 aic sbc; /* the options here ask SAS to: */ /* selection = stepwise: do stepwise variable selection */ /* sle = 0.25: with p = 0.25 to ENTER */ /* sls = 0.25: and p = 0.25 to STAY */ /* aic, sbc: report AIC and Schwartz BIC values for the selected model */ title 'Stepwise model selection'; run;