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 (December 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 3 Dec 2008 07:47:08 -0800
Reply-To:   Akramx <akram.chriai@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Akramx <akram.chriai@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   Merge Many to one without repeat
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

Hi everybody, I want to do a special merge. I have two tables A and B: data A; input ID $ 1 Num 12.; datalines; a 24 a 65 a 43 ; run;

data B; input ID $ 1 color $5.; datalines; a Red b Green c White ; run;

the usual merge BY ID fot these tables is : code: proc sort data=a; by ID;run; proc sort data=b; by ID;run;

data C; merge a(in=f1) b(in=f2); by ID; if f1; run;

result (Table C):

Obs ID Num color 1 a 24 Red 2 a 65 Red 3 a 43 Red

What I want is to merge only the first (or last) line By ID with the corresponding line in table B, like it's illustrated here: Obs ID Num color 1 a 24 Red 2 a 65 3 a 43

I can use : if not First.ID then Color=''; but you understand that it'a only a sample here, and in reality I have about 90 columns...

thanks for your help.


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