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 (May 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 25 May 2006 12:56:38 -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: Point function: something's wrong in my code

The index and key function works well. The reason why I used POINT is because of a demonstration given by Muthia Kachirayan. (see post 199231 06/03/29). In that example, POINT works well. However I couldn't get it to work in my own code. I browsed through the SAS HELP document. Seems like POINT and KEY can do similar things, though they can't be used together.

K.

On Thu, 25 May 2006 00:55:19 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>Kitty , > >Another solution which is designed to work with the data step would be: > >data lookup ( index = ( CaseId ) ) ; >input caseid fid; >cards; >5471290 1 >5471292 2 >5471294 3 >5471296 4 >5472960 5 >5472966 6 >5472990 7 >5472992 8 >5474030 9 >5474032 10 >; >run; > > > >data pair; >input caseid1 caseid2 amount; >cards; >5471290 5471294 345 >5471292 5472966 6423 >5471296 5472992 5500 >5472960 5474030 234 >5472990 5472992 4532 >5474032 5474030 3421 >; >run; > > >data need ; >set Pair ; >set LookUp ( rename = ( CaseId = CaseId1 Fid = Fid1 ) ) Key = CaseId1 ; >set LookUp ( rename = ( CaseId = CaseId2 Fid = Fid2 ) ) Key = CaseId2 ; >run ; > >proc print >data = Need ; >run ; > > > >Toby Dunn > > > > > >From: Kitty Lee <lee.kitty@YAHOO.COM> >Reply-To: Kitty Lee <lee.kitty@YAHOO.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: Point function: something's wrong in my code >Date: Wed, 24 May 2006 19:42:37 -0400 > >Hi. I tried to use the POINT function to look up data. There's something I >missed in my codes. > >I began with this master file which has the real caseid and an assigned id >called 'fid'. > >data lookup; >input caseid fid; >cards; >5471290 1 >5471292 2 >5471294 3 >5471296 4 >5472960 5 >5472966 6 >5472990 7 >5472992 8 >5474030 9 >5474032 10 >; >run; > >/*and I have another data 'pair' which pair up cases*/ > >data pair; >input caseid1 caseid2 amount; >cards; >5471290 5471294 345 >5471292 5472966 6423 >5471296 5472992 5500 >5472960 5474030 234 >5472990 5472992 4532 >5474032 5474030 3421 >; >run; > > >/*I need to lookup the fid codes from the 'lookup' data. My IDEAL dataset >would look like > >caseid1 fid1 caseid2 fid2 amount >5471290 1 5471294 3 345 >5471292 2 5472966 6 6423 >5471296 4 5472992 8 5500 >5472960 5 5474030 9 234 >5472990 7 5472992 8 4532 >5474032 8 5474030 9 3421 > >*/ > >/*I tried the following >*/ > >data ineed; >retain ; >do until (eof); >set pair end = eof; k1=caseid1; k2=caseid2; >set lookup (rename=(caseid=caseid1 fid = fid1)) point = k1 ; >set lookup (rename=(caseid=caseid2 fid = fid2)) point = k2 ; >output; >end; >stop; >run; > > >/* but I got the following message in the log >eof=1 caseid1=5474032 caseid2=5474030 amount=3421 k1=5474032 k2=5474030 >fid1=. fid2=. _ERROR_=1 >_N_=1*/ > >proc print data=ineed; run; > > Obs caseid1 caseid2 amount fid1 fid2 > 1 5471290 5471294 345 . . > 2 5471292 5472966 6423 . . > 3 5471296 5472992 5500 . . > 4 5472960 5474030 234 . . > 5 5472990 5472992 4532 . . > 6 5474032 5474030 3421 . . > > >Can someone kindly point out where I made a mistake? > >Thanks!! > >K.


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