BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tpham
Quartz | Level 8

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Tpham
Quartz | Level 8

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?

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
StatDave
SAS Super FREQ

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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