Programming the statistical procedures from SAS

Freezing variables in regression

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

Freezing variables in regression

Hi,

I'm using proc regression and i want to freeze a few variables. In other words, i dont want a few variables to get dropped. I'm trying to build a code, which can be used going forward. And where the user does not need to keep manually force including these variables.

Any ideas how i can take this forward?

Regards,

Nimish


Accepted Solutions
Solution
‎05-30-2014 09:20 AM
Trusted Advisor
Posts: 1,222

Re: Freezing variables in regression

Hi,

Put INCLUDE=n  in model statement, that forces the first n independent variables listed in the MODEL statement to be included in all models.

Thanks,

Naeem

View solution in original post


All Replies
Solution
‎05-30-2014 09:20 AM
Trusted Advisor
Posts: 1,222

Re: Freezing variables in regression

Hi,

Put INCLUDE=n  in model statement, that forces the first n independent variables listed in the MODEL statement to be included in all models.

Thanks,

Naeem

Occasional Contributor
Posts: 18

Re: Freezing variables in regression

Hi,

Can you help with the statement? As in where should i add the include option?

Cheers,

Nimish

Trusted Advisor
Posts: 1,222

Re: Freezing variables in regression

Hi,

proc reg data=have;

model  y=x1 x2 x3 x4/include=2 selection=forward;

quit;

First two variables x1 and x2 will be included in the model.

Thanks,

Naeem

Occasional Contributor
Posts: 18

Re: Freezing variables in regression

Hi Naeem,

I'm looking to use the regression output to build a new model. Lets say i have 10 variables in my initial model. And out of the 10, 2 have a high p -value. Now, I want to rerun my regression equation, after excluding these two variables, without having to manually write the code. Is this possible? If yes, can you suggest the best way forward.

Regards,

Nimish

Trusted Advisor
Posts: 1,222

Re: Freezing variables in regression

Hi,

Is there any cut off value to decide whether p-value high or not?

Thanks,

Naeem

Valued Guide
Valued Guide
Posts: 684

Re: Freezing variables in regression

I don't like the idea of automating this based on fixed p values. Model building should involve judgements and interpretation. All the stepwise procedures are VERY dangerous to start with, unless derived models are tested on independent data (at a minimum). p values can be very misleading in stepwise procedures. I highly recommend that you check out the GLMSELECT procedure for better ways of selecting predictor variables. The SAS Global Forum has some nice articles on use of this procedure.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 364 views
  • 9 likes
  • 3 in conversation