Date: Mon, 30 Sep 2002 11:16:35 -0400
Reply-To: Marianne Whitlock <WHITLOM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Marianne Whitlock <WHITLOM1@WESTAT.COM>
Subject: Re: cartesian product
Content-Type: text/plain; charset="iso-8859-1"
Another way to do a Cartesian product in a data step is:
data dec ;
input id $char3. ;
cards;
AAA
BBB
CCC
;
data del ;
input id $char3. ;
cards;
DDD
EEE
;
data DesCartes (keep=dec_id del_id);
set dec(keep=id rename=(id=dec_id));
I = 0 ;
do i = 1 to nobs ;
set del(keep=id rename=(id=del_id))
point = i nobs=nobs;
output;
end;
run;
proc print data = DesCartes;
run;
-----Original Message-----
From: Kent Skovgaard [mailto:kesedu@MAIL1.STOFANET.DK]
Sent: Sunday, September 29, 2002 2:25 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: cartesian product
I often have to create the cartesian product of 2 or more datasets. I use
Proc SQL to do the work, but I wonder if it is possible do create the
cartesian product in a "normal" SAS dataste and if it is more efficient than
the sql-procedure.
Thank you.
Kent Skovgaard