Programming the statistical procedures from SAS

change reference level for categorical variable in linear regression

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

change reference level for categorical variable in linear regression

Dear,
I have to set a multiple linear regression with continuous and categorical variables. 

SAS uses the highest value of a categorical variable as the reference level. How can I change the reference level of a categorical variable? 

Can I use CLASS statement with the REF OPTION (REF=FIRST) in the PROC REG or PROC GLM?

Thanks


Accepted Solutions
Solution
‎03-08-2017 06:10 PM
Super User
Posts: 20,731

Re: change reference level for categorical variable in linear regression

Posted in reply to d_margiotta

PROC GLMSELECT allows it. I don't know about the others, but thought they didn't. 

View solution in original post


All Replies
Solution
‎03-08-2017 06:10 PM
Super User
Posts: 20,731

Re: change reference level for categorical variable in linear regression

Posted in reply to d_margiotta

PROC GLMSELECT allows it. I don't know about the others, but thought they didn't. 

New Contributor
Posts: 2

Re: change reference level for categorical variable in linear regression

Thanks
Occasional Contributor
Posts: 18

Re: change reference level for categorical variable in linear regression

Posted in reply to d_margiotta

Can you use PROC GLMSELECT to perform a standard linear regression? I'm running into the same problem with the reference group for my categorical variables. Thanks!

Super User
Posts: 20,731

Re: change reference level for categorical variable in linear regression

Posted in reply to abarnett313

You can create the dummy variables in many different ways and use PROC REG.

https://communities.sas.com/t5/SAS-Statistical-Procedures/How-to-create-dummy-variables-Categorical-...

 

But otherwise I think you can, this is from the documentation and I'm going to guess the first three sentences are what you need?

 

The GLMSELECT procedure compares most closely to REG and GLM. The REG procedure supports a variety of model-selection methods but does not support a CLASS statement. The GLM procedure supports a CLASS statement but does not include effect selection methods. The GLMSELECT procedure fills this gap. GLMSELECT focuses on the standard independently and identically distributed general linear model for univariate responses and offers great flexibility for and insight into the model selection algorithm. GLMSELECT provides results (displayed tables, output data sets, and macro variables) that make it easy to take the selected model and explore it in more detail in a subsequent procedure such as REG or GLM.

SAS Employee
Posts: 308

Re: change reference level for categorical variable in linear regression

Posted in reply to d_margiotta

You can use the REF= option in the CLASS statement in PROC GLM. PROC REG does not have a CLASS statement. See this note on the topic for many procedures.

☑ This topic is solved.

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

Discussion stats
  • 5 replies
  • 215 views
  • 1 like
  • 4 in conversation