turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Interactions in a regression

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-29-2015 10:16 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-30-2015 09:37 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-30-2015 07:52 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-31-2015 07:13 AM

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