Hi,
This is my first time posting on SAS Support Communities, so please correct me if I'm not using the correct format for my question.
So here is my problem. I have 5 main continuous effects (Y A B C D) and 1 class effect (3 levels) M. I would like to do a regression with interactions in a form of:
Y= A B C D M AM BM CM DM
Could you please help me how to code this on sas.
Thanks, Mai
In a procedure such as PROC GLM you can say
model Y= A B C D M A*M B*M C*M D*M;
You can look at the GLM documentation for a full description of how to specify interactions in SAS regression procedures that support this syntax. The section also includes notational "shortcuts" and how to specify common models.
Dear Erik,
Thank you very much for your prompt response. I was able to make the code with Proc GLM in my previous question. My next problem is I'm having 2 groups of variables: 10 continuous variables X1 x2 .. X10 (and maybe more) and 7 class variables C1 C2 ..C7. Is there any short cut way of coding the interactions between continuous variables and class variables, but excluding interactions within their groups:
X1..X10 X1C1 X1C2.. X1C7 X2C1..X2C7 ...X10C1..X10C7 C1..C7
I tried (X1X2..X10)|(C1..C7) but the certainly it was not correct syntax.
Thanks, Mai
I do not know how do that. People have written macros that generate models like that. You can try an internet search for terms like
sas macro regression model pairwise interactions
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.