Date: Tue, 8 Feb 2000 00:29:57 GMT
Reply-To: Lou Pogoda <lpogoda@HOME.NOSPAM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou Pogoda <lpogoda@HOME.NOSPAM.COM>
Organization: @Home Network
Subject: Re: many to many match merge
That turns out not to be the case - example code has been posted here in the
past. Assuming the key variable to "merge" on is called KEYVAR and is
present on both data sets, a crude version would look something like:
data foo;
set fee;
do n = 1 to howmany;
set fie (rename = (keyvar = keevar)) nobs = howmany point = n;
if keevar = keyvar then output;
end;
run;
I say crude because this example compares every observation in FIE with
every observation in FEE. Modifying it to take advantage of key-value order
is left as an exercise for the reader.
Such code is admittedly a little more complicated to write than the SQL
version. On the other hand, depending on platform, observation size, and
the phase of the Moon, I've seen the data step version take slightly over
half as much cpu time as the sql version.
David L. Ward wrote in message <200002071541857.SM00138@www3>...
>There's no way to do this in a data step, only proc SQL:
>proc sql;
> select tablea.userid, tablea.group, tableb.profile from tablea, tableb
where tablea.group=tableb.group;
>quit;
>
>
>HTH
>David Ward
|