LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 24 Mar 2006 16:17:14 +0000
Reply-To:   toby dunn <tobydunn@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   toby dunn <tobydunn@HOTMAIL.COM>
Subject:   Re: a dataset merging question TIA
Comments:   To: kiki886@GMAIL.COM
In-Reply-To:   <200603241606.k2OFwOjH002614@mailgw.cc.uga.edu>
Content-Type:   text/plain; format=flowed

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


Back to: Top of message | Previous page | Main SAS-L page