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 (July 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Jul 2003 11:54:29 -0700
Reply-To:     Prasad S Ravi <prasad.s.ravi@HOUSEHOLD.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Prasad S Ravi <prasad.s.ravi@HOUSEHOLD.COM>
Subject:      Re: help
Comments: To: Max <max8ca@YAHOO.COM>
Content-type: text/plain; charset=us-ascii

Max:

Try this.

data d2; set d1; by id lnum; retain clm2; if first.lnum then do; clm2=clm; end; run;

Prasad Ravi

Max <max8ca@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Sent by: "SAS(r) cc: Discussion" Subject: help <SAS-L@LISTSERV.UGA.E DU>

07/18/2003 11:28 AM Please respond to Max

Hello there,

I have a dataset where one variable have some missing value. I want to replace the missing value with the value above it under the same LNUM. The original data is

ID LNUM clm

483 9048 J085 483 9943 483 2652 H915 483 2652

I need to create a new variable that takes the same value for CLM under the same LNUM, so the new variable looks like:

ID LNUM clm clm2

483 9048 J085 J085 483 9943 483 2652 H915 H915 483 2652 H915

I tried to use RETAIN, but it assigns the value for LNUM 9943, which is not supposed to:

ID LNUM clm clm2

483 9048 J085 J085 483 9943 JO85 483 2652 H915 H915 483 2652 H915

My code is

data d2; set d1; by id lnum; retain clm2; if clm ne ' ' then do; clm2=clm; end; run;

Any help would be appreciated.

Max

__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com


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