Date: Thu, 5 May 2005 14:29:03 -0700
Reply-To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject: Re: Efficient Way to write out all possibilities
Iris -
Try a Proc SQL cartesian self-join
proc sql;
create table combinations as
select *
from sashelp.class(keep=name),
sashelp.class(keep=sex),
sashelp.class(keep=age);
quit;
Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Iris
Hui
Sent: Thursday, May 05, 2005 2:10 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Efficient Way to write out all possibilities
I have 5 variables:
age (73 categories that go from age 0 to age 72);
education (5 categories, less than high school, hs grad, some college,BA,
grad school);
sex (2 categories, male, female);
cohort (3 categories, cohort 1,2,3);
trial (2 categories, trial 1, 2);
I need to create a dataset that contains all the possible combination of
these 5 variables. I know the dataset should have 73*5*2*3*2=4380 lines.
What's an efficient way to program SAS to develop that data?
Any help would be highly appreciated!
Iris
|