|
Lei ,
Use SQL join :
data a ;
input id score ;
cards ;
1 2
2 3
3 3
;
run ;
data b ;
input score Count;
cards;
2 2.1
2 2.2
3 3.1
3 3.3
3 3.4
;
run ;
proc sql ;
select b.* , a.Id
from a as a
right join
b as b
on a.score = b.score
order by a.ID ;
quit ;
Toby Dunn
From: Lei Yu <kiki886@GMAIL.COM>
Reply-To: Lei Yu <kiki886@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: a dataset merging question TIA
Date: Fri, 24 Mar 2006 11:06:51 -0500
Suppose two datasets have the form as follows
data a; input id score;
cards;
1 2
2 3
3 3
;
run;
data b; input score output;
cards;
2 2.1
2 2.2
3 3.1
3 3.3
3 3.4
;
run;
I wanna merge by score and the result I expected is sth like
id score output
1 2 2.1
1 2 2.2
2 3 3.1
2 3 3.2
2 3 3.3
3 3 3.1
3 3 3.2
3 3 3.3
How can I code this? thanks...
LY
|