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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 959 views
  • 0 likes
  • 4 in conversation