Programming the statistical procedures from SAS

Proc reg and reference groups

Accepted Solution Solved
Reply
Contributor
Posts: 58
Accepted Solution

Proc reg and reference groups

Dataset

IDYX1 (Categorical)X2 (categorical)
18521
215645
37818
445639

1) I think by default, proc reg selects the lowest values as the reference variable right? In this case the reference value of X1/X2 will be 1.  If I were to run:

Proc reg data=have;

model y=x1 x2;

run;

2) If I wanted the reference value to be 2 for the X1 variable, how do I do it?


Accepted Solutions
Solution
‎01-09-2015 09:19 AM
Trusted Advisor
Posts: 1,670

Re: Proc reg and reference groups

You can't use character or categorical variables in the model statement of PROC REG.

If you want to do this in PROC GLM, the last value alphabetically will have it's coefficient set to zero. Which in general is pretty irrelevant since you can use the TEST or ESTIMATE statement to compare level 2 to any (combination of) other levels.

I assume your actual data set contains more than the 4 observations shown.

View solution in original post


All Replies
Solution
‎01-09-2015 09:19 AM
Trusted Advisor
Posts: 1,670

Re: Proc reg and reference groups

You can't use character or categorical variables in the model statement of PROC REG.

If you want to do this in PROC GLM, the last value alphabetically will have it's coefficient set to zero. Which in general is pretty irrelevant since you can use the TEST or ESTIMATE statement to compare level 2 to any (combination of) other levels.

I assume your actual data set contains more than the 4 observations shown.

Contributor
Posts: 58

Re: Proc reg and reference groups

Thanks I'll look into Proc GLM. Yes there is more than 4 observations in my dataset shown Smiley Happy

Can I use the class statement to set the reference value for Proc GLM?

Trusted Advisor
Posts: 1,670

Re: Proc reg and reference groups

You would use the TEST or ESTIMATE statements to compare level 2 to any other level.

Or you can specify the level you want to have coefficient of zero in the CLASS statement.

SAS Employee
Posts: 241

Re: Proc reg and reference groups

Yes, you can set the reference level for CLASS variables in PROC GLM (beginning in SAS 9.3 TS1M2).  See this note about setting reference levels.

🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 959 views
  • 3 likes
  • 3 in conversation