Date: Tue, 16 Nov 2004 14:51:37 -0600
Reply-To: "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Subject: Re: Aggregation
Content-Type: text/plain; charset="us-ascii"
Rob,
It's a good question,
Try one of the following:
Proc sql ;
create table match as
select a.* , b.hardware
from a as a , b as b
where a.id = b.id ;
Quit ;
Or try the following assuming they are both sorted by id.
Data match ;
Merge a (in = a)
b (in = b);
By id ;
If a and b ;
Run;
Either should get you what you want.
HTH
Toby Dunn
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Rob
Sent: Tuesday, November 16, 2004 2:40 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Aggregation
Hi
New to this ng and to SAS so please excuse a naive question:
I have two tables a and b. Both have the same common key. All I want
to
do is match a to b returning a row for all rows in a that have a match
in b. I'm only trying to pull off one extra field from b. A looks like
this
ID Name Address
1 Fred 1 Road Road
1 Jim 94 Road Road
2 George 91 Road Road
3 Barney 104 Road Road
B looks like this
ID Hardware
1 Athlon
2 P4
So what I'd like to see is:
1 Fred 1 Road Road Athlon
2 Jim 94 Road Road P4
3 Barney 104 Road Road n/a
[sorry if the tabs don't show up correctly on your servers]
I've been doing this via a proc sql with and without a left join on ID
but
I'm not ending up with 3 rows in the table I create. It's doing
something
else. I've also tried using merge instead but again I end up with more
than the 3 rows I'm expecting.
Advice please - this is so simple in Excel, but with 15 million rows,
it's not going to be Excel friendly.
Cheers
Rob