BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
liyongkai800
Obsidian | Level 7

 

I am wondering is there any way to generate the interaction by groups.

 

say the following program generates the effects x1,x2 and x1*x2 :

 

proc glmselect;

effect poly = polynomial(x1-x2/degree=2 mdegree=1);

model y = poly/selection=none;

run;

 

However, if I have x1,x2,y1,y2 and want to generate the effects x1,x2,x1*x2,y1,y2 and y1*y2, how to modify the effect statement? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
arthurcavila
Obsidian | Level 7

You can add a second effect statement, but it is a lot easier to modify your model statement instead.

 

 

proc glmselect data = sashelp.baseball;
    effect poly = polynomial(nhits nrbi / degree = 2 mdegree = 1);
    effect poly2 = polynomial(nouts nerror / degree = 2 mdegree = 1);
    model logsalary = poly poly2 / selection = none;
run;

 

proc glmselect data = sashelp.baseball;
    model logsalary = nhits|nrbi nouts|nerror / selection=none;
run;

View solution in original post

2 REPLIES 2
arthurcavila
Obsidian | Level 7

You can add a second effect statement, but it is a lot easier to modify your model statement instead.

 

 

proc glmselect data = sashelp.baseball;
    effect poly = polynomial(nhits nrbi / degree = 2 mdegree = 1);
    effect poly2 = polynomial(nouts nerror / degree = 2 mdegree = 1);
    model logsalary = poly poly2 / selection = none;
run;

 

proc glmselect data = sashelp.baseball;
    model logsalary = nhits|nrbi nouts|nerror / selection=none;
run;

liyongkai800
Obsidian | Level 7
Thanks, it's good to know

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1282 views
  • 0 likes
  • 2 in conversation