Dataset
ID | Y | X1 (Categorical) | X2 (categorical) |
---|---|---|---|
1 | 85 | 2 | 1 |
2 | 156 | 4 | 5 |
3 | 78 | 1 | 8 |
4 | 456 | 3 | 9 |
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?
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.
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.
Thanks I'll look into Proc GLM. Yes there is more than 4 observations in my dataset shown
Can I use the class statement to set the reference value for Proc GLM?
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.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.