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

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 2598 views
  • 0 likes
  • 4 in conversation