Interactions in a regression

Reply
Contributor
Posts: 24

Interactions in a regression

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

SAS Super FREQ
Posts: 3,624

Re: Interactions in a regression

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.

Contributor
Posts: 24

Re: Interactions in a regression

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

SAS Super FREQ
Posts: 3,624

Re: Interactions in a regression

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

Ask a Question
Discussion stats
  • 3 replies
  • 215 views
  • 0 likes
  • 2 in conversation