BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I want to get all possible multiplicative interactions i.e, my input variable has 4 categeories. (say A, B, C, D) and then how can i get all possible interactions.
A*B, A*C,... A*B*C, A*B*D,... etc.)


Thanks.
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
If you are talking about PROC MEANS and CLASS variables, look at the doc for the TYPES and WAYS statements:
http://support.sas.com/documentation/cdl/en/proc/59565/HTML/default/a000146737.htm

cynthia
Patrick
Opal | Level 21
Hi
Below a code example to get what you asked for.
Have also a look at Proc Mixed and the like - may be that's in the end what you're aiming for.
HTH
Patrick

data have;
do CatVar='a','b','c','d','e','b';
output;
end;
run;

proc sql;
create view Vhave as
select Distinct CatVar
from have
order by CatVar;
quit;

proc transpose data=Vhave out=TransHave;
var CatVar;
run;

proc summary data=TransHave;
class col:;
output out=CombHave(where=(_type_ ne 0));
run;

data want;
set CombHave;
CombVar=cats(of col:);
run;

proc print data=want;
run;
Doc_Duke
Rhodochrosite | Level 12
In GLM, you can use the "bar operator" (|) to get all possible interactions. I suspect that syntax would work in MIXED as well. Check the syntax in the MODEL statement.

Doc Muhlbaier
Duke

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1572 views
  • 0 likes
  • 4 in conversation