We are running a linear regression model with 4 numerical independent variables predicting a numerical dependent variable. We now need to add two additional categorical independent varables.
The client wants a seperate prediction for each commbination of the two new categorical independent variables.
Thinknig of proc GLM with the categorical variables in the class statement, but can't see how to get a separate prediction forf each commbination of the two new categorical independent variables. All help will be appreciated, Thank you!
Thank you! using proc GLM the way you suggest, how can I get a separate predition for each combinatin of teh two categorical variables?
Also we just realized we will need to do the same also for a model where we use autoreg due to autocorrelation in teh data. Id there a way to add teh two class variables to proc autoreg or another proocn that can handle data with autocorrelation (we can add the lag of the dependent variable to the GLM model' but that would not be the same as running proc autoreg). Thamnk you!
@StatDave wrote:
Include the interaction of the two categorical variables. For example, for two categorical variables, a and b, their interaction is a*b:
class a b;
model y=x1 x2 a b a*b;
Thank you! I use the "PREDICTED" value I get from the model output. Will the intercation you wrote result in getting a predicted value for each combination?
Thank you very much for all your help!
@Taliah wrote:
The client wants a seperate prediction for each commbination of the two new categorical independent variables.
Although @StatDave has provide a complete and correct answer, I feel it would be helpful to point out that you do NOT get predictions for "each combination" of the independent variable. You get predictions for each observation. This has nothing to do with SAS, this is how the math works.
Thank you!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.