turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- linear regression model, force independent variabl...

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-07-2016 04:48 PM

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;
```

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to wenling

07-07-2016 05:06 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

07-07-2016 05:27 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to wenling

07-07-2016 05:56 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

07-08-2016 09:18 AM

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 */

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to wenling

07-08-2016 12:10 PM

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.