Date: Fri, 21 Jun 2002 06:24:52 -0700
Reply-To: shiling zhang <shiling99@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: shiling zhang <shiling99@YAHOO.COM>
Organization: http://groups.google.com/
Subject: Re: looping match merge?
Content-Type: text/plain; charset=ISO-8859-1
SQL can create this type of product(Cartesian Product) easily. Please
take a look the follow example. It blows up really quick. The total
obs will be NOBS(dataset t1) X NOBS (dataset t2). You also can create
Cartesian Product within a key group too.
HTH
data t1 t2;
do x=1,2,3;
output t1;
end;
do y=4,5,6;
output t2;
end;
run;
proc sql;
select t1.x , t2.y
from t1 , t2
;
quit;
Arthur Ellen <arte@panix.com> wrote in message news:<aetp6g$phd$1@reader1.panix.com>...
> I'm trying something like this example,
> where I want to perform a match merge,
> but go back and sequentially go through
> the smaller file.
>
> DATA A;
> INPUT X;
> MERGEVAR=99;
> CARDS;
> 1
> 2
> 3
> 4
> 5
> ;
> DATA B;
> INPUT Y;
> MERGEVAR=99;
> CARDS;
> 5
> 10
> 15
> ;
> DATA C;
> MERGE A B;
> BY MERGEVAR;
> /* I want to be able to just use
> _N_=1 for Data B then go
> select the 2nd until Data B completes
> */
> ARRAY Z(3);
> Z(1)=X+Y;
> Z(2)=X+Y;
> Z(3)=X+Y;
> PROC PRINT;
> RUN;
>
> What I'd like to get
>
> X MERGEVAR Y Z1 Z2 Z3
>
> 1 1 99 15 6 11 16
> 2 2 99 15 7 12 17
> 3 3 99 15 8 13 18
> 4 4 99 15 9 14 19
> 5 5 99 15 10 15 20
>
> art ellen
> arte@panix.com
|