| Date: | Thu, 6 Dec 2001 12:27:49 -0800 |
| Reply-To: | Leo Chan <leo.y.h.chan@GRADUATE.HKU.HK> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Leo Chan <leo.y.h.chan@GRADUATE.HKU.HK> |
| Organization: | IMS Netvigator |
| Subject: | Re: Cartesian product |
|---|
Use the example below. However why don't use SQL?
data mm4;
set aa;
do i=1 to nobs;
set a (rename=(b=bb)) point=i nobs=nobs;
if b=bb then output;
end;
drop bb;
run;
Leo
"CAFO" <cafo@int.tele.dk> wrote in message
news:3c0ce721$0$25373$edfadb0f@dspool01.news.tele.dk...
> Hi ,
>
> How do I create the Cartesian product that I get from the program below
> using datastep in stead of sql ?
>
> data a;
>
> length b $10;
>
> a=1; b='BO'; output;
>
> a=2; b='BO'; output;
>
> a=3; b='IB'; output;
>
> a=4; b='MY'; output;
>
> a=5; b='MY'; output;
>
> run;
>
> data aa;
>
> length b $10;
>
> aa=1; b='BO'; output;
>
> aa=2; b='BO'; output;
>
> aa=3; b='IB'; output;
>
> aa=51; b='MY'; output;
>
> aa=52; b='MY'; output;
>
> aa=53; b='MY'; output;
>
> aa=54; b='MY'; output;
>
> run;
>
> proc sql;
>
> create table kk as
>
> select *
>
> from a, aa
>
> where a.b=aa.b;
>
> quit;
>
> proc sort;
>
> by b a aa;
>
> run;
>
>
>
|