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 (June 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 30 Jun 2006 17:19:44 -0400
Reply-To:     Kitty Lee <lee.kitty@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kitty Lee <lee.kitty@YAHOO.COM>
Subject:      Re: Merge fails to pick up ID?

Yes, there're identical caseid. In fact my dataset B was initially extracted from dataset A. I did some fancy statistical calculation in R and am now trying to bring the results back to my original dataset A. So the caseids are identical...

K.

On Fri, 30 Jun 2006 14:00:04 -0700, Ken Moody <kmoody_chc@YAHOO.COM> wrote:

>Kitty, > In cases like this you want to be able to demonstrate exactly how the process is failing. One way to do that is to print enough of each data set to show that there are values of CaseID that are identical and should have resulted in a single row in your output table. Or, if you can't find any identical keys you will know why the size of the output is the sum of the input tables. I'm guessing that you will find that the values of CaseID in data set A have leading zeros, and the values that you constructed in data set B do not, so they didn't match. > > Ken > >Kitty Lee <lee.kitty@YAHOO.COM> wrote: Hi. I have a funny situation.I have two dataset A and B and I need to >perform a simple merge by CaseID. > >I did a proc contents of data A. The Caseid variable has this format > >CASEID Char 24 $24. $24. CASEID > >My dataset B originally has Caseid as a numeric. I did this to change the >format. > >data newB (keep=caseid raw estmm); >caseid=put(caseidA, 24.); >set B(rename=caseid=caseidA); >run; > >I checked the proc contents of the new dataset newB: > ># Variable Type Len Format Informat >1 caseid Char 24 > > >Then I tried to merge the two datasets. > >data joinAB; merge A newB; by caseid; run; > >But the merge failed. Essentially the two datasets were stacked up >instead---Dataset A has 1000 cases and Dataset newB has 300 cases. The >dataset after merge has 1300 cases. > >Somehow the program thinks the caseids are different. How come? > >K. > > > >--------------------------------- >Do you Yahoo!? > Everyone is raving about the all-new Yahoo! Mail Beta.


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