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 (January 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 29 Dec 2009 13:59:25 -0800
Reply-To:     Patrick <patrick.matter@GMX.CH>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Patrick <patrick.matter@GMX.CH>
Organization: http://groups.google.com
Subject:      Re: Replace missing address with most recent address? Thank you!
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Hi Nancy

Not sure if this is what you're after:

data have; infile datalines truncover dsd dlm=' '; input @1 ID @3 address $ @8 date:ddmmyy.; format date date9.; datalines; 1 01/01/2009 1 abcd 01/05/2009 1 cdef 01/06/2009 2 defg 01/02/2009 2 adbc 01/05/2009 2 01/03/2009 ; proc sort data=have; by id date; run;

data want; set have; by id; retain lagaddress; lagaddress=lag(address); if first.id then address2=address; else if not first.id then do; address2=coalescec(address,lagaddress); end; run; proc print data=want; run;

HTH Patrick


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