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 (February 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 14 Feb 2005 18:04:50 -0500
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: missing value
Content-Type:   text/plain; charset=ISO-8859-1

Good old Double DoW does it:

data need(drop = firstmtb); do until (last.id_firm); set have; by id_firm notsorted; if missing(firstmtb) and not missing(mtb) then firstmtb = mtb; end; do until (last.id_firm); set have; by id_firm notsorted; if missing(mtb) and not missing(ri) then mtb = firstmtb; output; end; run;

On Mon, 14 Feb 2005 18:40:08 +0100, pierre magin <pierre_magin@YAHOO.FR> wrote:

>Hi all; > >I have the following data; and I want to replace >the missing value of the variable mtb by the first not >missing one when the variable ri is not missing. > > > >date Id_firm ri mtb >01/01/1990 34567 . . >01/02/1990 34567 23 . >01/03/1990 34567 25 . >01/04/1990 34567 30 2 >01/05/1990 34567 35 1,5 >01/06/1990 34567 33 1,7 >01/01/1990 14493 . . >01/02/1990 14493 60 . >01/03/1990 14493 41 1,5 >01/04/1990 14493 32 2 >01/05/1990 14493 56 1,9 >01/06/1990 14493 57 2,1 >. . . . >. . . . >. . . . > >I need to get the following final set > >date Id_firm ri mtb >01/01/1990 34567 . . >01/02/1990 34567 23 2 >01/03/1990 34567 25 2 >01/04/1990 34567 30 2 >01/05/1990 34567 35 1,5 >01/06/1990 34567 33 1,7 >01/01/1990 14493 . . >01/02/1990 14493 60 1,5 >01/03/1990 14493 41 1,5 >01/04/1990 14493 32 2 >01/05/1990 14493 56 1,9 >01/06/1990 14493 57 2,1 >. . . . >. . . . >. . . . > >Any help is appreciated. > > >Pierre. > > > > > > > >Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! >Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/


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