Date: Sat, 1 Jul 2006 16:02:12 +0000
Reply-To: iw1junk@COMCAST.NET
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: Re: Merge fails to pick up ID?
Kitty,
This probably isn't your problem, but it shows the
possibilities and might be difficult to locate without
looking at the code.
data a ;
length caseid $ 24 ;
do id = 1 to 5 ;
caseid = put ( id , 8. ) ;
output ;
end ;
run ;
data b ;
length caseid $ 24 ;
do id2 = 1 to 5 ;
caseid = put ( id2 , 8. ) ;
substr(caseid,1,1) = '00'x ;
output ;
end ;
run ;
data c ;
merge a b ;
by caseid ;
run ;
proc print data = c ;
run ;
Here is the print of C.
Obs caseid id id2
1 1 . 1
2 2 . 2
3 3 . 3
4 4 . 4
5 5 . 5
6 1 1 .
7 2 2 .
8 3 3 .
9 4 4 .
10 5 5 .
Try taking to match CASEIDs and put them using
$HEX48.
Note to Michael Davis: How is this for a "cheap and cleazy trick"
to mess up anyone stealing your data?
It might also qualify for Bob Virgile Puzzle.
Ian Whitlock
=================
Date: Fri, 30 Jun 2006 20:09:51 -0400
Reply-To: Kitty Lee <lee.kitty@YAHOO.COM>
Sender: "SAS(r) Discussion"
From: Kitty Lee <lee.kitty@YAHOO.COM>
Subject: Re: Merge fails to pick up ID?
Oh, I have spent so many hours on something that's supposed to be simple.....
As suggested by Howard & Arthur, I did define the numeric to character. I
also did the trimming and left-adjust.
Because my dataset B was in .csv format (for R). I tried to export my
original file out as .csv, reimported it back and tried to merge. Still failed.
Finally, I thought I should 'go back to the basics'....
I ended up creating a new caseid (=_n_) and redid everything. Now the merge
worked.
Still a big puzzle why the program can't recognize the original
caseid.....:-( though the primitive method came to the rescue.
K.
<snip>