LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 31 Jul 2008 17:07:00 -0700
Reply-To:   jenmoocat <sollje2002@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   jenmoocat <sollje2002@YAHOO.COM>
Organization:   http://groups.google.com
Subject:   technique to enumerate interaction terms
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

Another question for you kind folks....

Given a macro variable that is a list of words, I need to generate another macro variable that contains a list of all of the interaction terms that can be derived from those words.

For example, if the list is

%LET MYLIST = JEN JOHN CHRIS;

I need a list MYNEWLIST

%PUT &MYNEWLIST: JEN JOHN CHRIS JEN_JOHN JEN_CHRIS JOHN_CHRIS JEN_JOHN_CHRIS

The above example starts with a three-element list. I need to make my macro flexible enough to handle any number of elements.

The macro that I originally wrote did this in a really crude, brute force manner by 1) creating a 10-row temp dataset with one variable for each of the elements in the list, plus an indicator variable 2) populating this dataset with random numbers 3) running PROC ANOVA 4) using ODS to get the Means table 5) using the EFFECT variable in the Means table to get the enumerations of the interactions

PROC ANOVA DATA=BLEH; CLASS JEN JOHN CHRIS; MODEL I = JEN|JOHN|CHRIS; MEANS JEN|JOHN|CHRIS; QUIT;

I do know that this is really a silly way to do this.

Plus --- there seems to be a limit to the size of the EFFECT variable in the Means table. If it gets too big, it truncates the names. If I start with JENNIFER JOHNATHAN CHRISTOPHER I end up with: JENNIFER JOHNATHAN CHRISTOPHER JENNIFER_JOHNATHAN JENNIFER_CHRISTOPHER JOHNATHAN_CHRISTOPHE JENNIF_JOHNAT_CHRIST which won't work in the system that I am designing.

Anyone have a better way to do this? I have started to design the looping structure necessary -- but am getting tangled up. Can anyone point me in the right direction? Does anyone know how to expand the size of the EFFECT variable in the Means table from PROC ANOVA?

Thanks in advance,

-jennifer.


Back to: Top of message | Previous page | Main SAS-L page