DATA Step, Macro, Functions and more

How to get all possible multiplicative interactions

Reply
N/A
Posts: 0

How to get all possible multiplicative interactions

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.
SAS Super FREQ
Posts: 8,743

Re: How to get all possible multiplicative interactions

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
Respected Advisor
Posts: 3,892

Re: How to get all possible multiplicative interactions

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 colSmiley Happy;
run;

proc print data=want;
run;
Trusted Advisor
Posts: 2,113

Re: How to get all possible multiplicative interactions

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
Ask a Question
Discussion stats
  • 3 replies
  • 141 views
  • 0 likes
  • 4 in conversation