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.
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;
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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.