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 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 27 Jun 2005 12:19:21 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: help with data step needed to get replace missing values with
              values from previous record

and fdate = lag(fdate)

On Mon, 27 Jun 2005 08:16:06 -0700, Terjeson, Mark (IM&R) <Mterjeson@RUSSELL.COM> wrote:

>Hi MK, > >Here is one approach: > > >data sample; > input id @3 fdate date7. @11 ldate date7. @19 int; >cards; >1 08aug02 25jul01 54 >2 08aug02 25jul01 54 >3 08aug02 15aug03 . >4 08aug02 15aug03 . >5 08aug02 15aug03 33 >6 08aug02 15aug03 . >7 08aug02 15aug03 44 >8 08aug02 15aug03 . >; >run; > > >data result(drop=hold_int); > retain hold_int .; > set sample; > > if fdate ne . > and ldate ne . > and int eq . then int = hold_int; > > hold_int = int; >run; > > > > >Hope this is helpful. > > >Mark Terjeson >Senior Programmer Analyst, IM&R >Russell Investment Group > > >Russell >Global Leaders in Multi-Manager Investing > > > > > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of m k >Sent: Monday, June 27, 2005 7:58 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: help with data step needed to get replace missing values with >values from previous record > > >Hi >I have a dataset with the following values. > >id fdate ldate int >1 08aug02 25jul01 54 >2 08aug02 25jul01 54 >3 08aug02 15aug03 . >4 08aug02 15aug03 . > >How can I change it to the following specification. > >If int=. and fdate^=. and ldate^=. then int=<the int value from the >above line if the fdate for this line is equal to the fdate for the >above line>; > >such that the output looks like this > >id fdate ldate int >1 08aug02 25jul01 54 >2 08aug02 25jul01 54 >3 08aug02 15aug03 54 >4 08aug02 15aug03 54 > >I think I have to use a retain statement??? but I dont know how to >proceed. > >Thanks you all for your help as always >MK > > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com


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