BookmarkSubscribeRSS Feed
Bal23
Lapis Lazuli | Level 10

please let me know whether my code is correct for this purpose

any other advice?

thanks

proc stepwise data =have ;
 model money= invar condum1 condum2 condum3 / forward;	 run;
proc stepwise data =have ;
 model money= invar condum1 condum2 condum3 / backward;	 run;
5 REPLIES 5
Reeza
Super User

No, it's not correct.

 

There's no proc stepwise, I assume you meant reg?

Neither of those force an independent variable to be included, use the INCLUDE option on the model statement to force a variable to be included. 

 

You don't need multiple procs, proc reg can handle multiple MODEL statements. 

Reeza
Super User

I can't find anything in the documentation to support a stepwise procedure. 

 

If it's a custom proc you'll need to contact the authors for support.

 

https://support.sas.com/documentation/onlinedoc/stat/indexproc.html#stat141

 

If you find the documentation please post it here. 

Bal23
Lapis Lazuli | Level 10

 

The author said,

***************

Stepwise Regression Using SAS

In this example, the lung function data will be used again, with two separate analyses.

o Analysis 1: Determining which independent variables for the father (**bleep**e,

fheight, fweight) significantly contribute to the variability in the father’s (ffev1)?

o SAS commands are:

Proc STEPWISE;

Model ffev1=**bleep**e fheight fweight;

Title 'Stepwise regression of father data';

Run;

 

another report:

https://www.stat.wisc.edu/~yandell/software/sas/linmod.html

Stepwise Regression

There is a stepwise model selection regression method. It works something like doing a series of proc regs, but the computer automatically makes the model choices of entry and elimination. Watch out! Be sure you know what this is doing for you (and to you).

proc stepwise;
   model y = x1 x2 x3;

Here are model options for the means of selection and elimination:

   model y = x1 x2 x3 / forward;	/* forward selection */
   model y = x1 x2 x3 / backward;	/* backward elimination */
   model y = x1 x2 x3 / stepwise;	/* forward in & backward out */
   model y = x1 x2 x3 / maxr stop=4;	/* like stepwise, but using R^2 */

The cheapest methods are backward (or b) and forward (or f). The stepwise option (the default) is not much more costly, and a good idea in practice, as it checks back and forth. The maxr option is much more expensive, but does consider pairs of variables in ways possibly missed by stepwise; the stop=4 option to maxr only considers models with 4 or fewer variables, at considerable time savings. There is an alternative to maxr (called minr) which is even more costly.

   model y = x1 x2 x3 / noint;	     /* no intercept */
   model y = x1 x2 x3 / slentry=0.5; /* signif. level for selection */
   model y = x1 x2 x3 / slstay=0.1;  /* signif. level for elimination */
   model y = x1 x2 x3 / include=2;   /* force in first 2 variables */
   model y = x1 x2 x3 / start=2;     /* start with 2 variables */
   model y = x1 x2 x3 / details;     /* more details of R^2, F stats */

 

Reeza
Super User

You realize that's a 20+ year old webpage? 1995? 

I can't find a single SAS reference to it anywhere, including Lexjansen.com which goes back a long way. 

 

Regardless, you can get what you want out of proc REG. 

 

If if you want help with proc stepwise contact support@sas.com. I'd be interested in their response. 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1850 views
  • 0 likes
  • 2 in conversation