Date: Fri, 3 May 2002 09:17:45 -0400
Reply-To: "Braten, Michael (Exchange)" <mbraten@BEAR.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Braten, Michael (Exchange)" <mbraten@BEAR.COM>
Subject: FW: Last non-Blank value
Content-Type: text/plain
> YES! OOPS!
>
> data oset;
> set iset;
> array months {12} $ 20 dec02 noc02 .................. ;
>
> prv = . ;
> do i = 1 to dim(months) ;
> if months(i) ne ' ' then prv= months(i) ;
> if prv ne . then leave;
> end;
>
>
>
> > -----Original Message-----
> > From: Zack, Matthew M. [SMTP:mmz1@cdc.gov]
> > Sent: Friday, May 03, 2002 7:45 AM
> > To: 'Braten, Michael (Exchange)'
> > Subject: RE: Last non-Blank value
> >
> > Doesn't your solution read only the first member of the array, MONTHS,
> > before leaving the iterative DO-END loop?
> >
> > Matthew Zack
> >
> > -----Original Message-----
> > From: Braten, Michael (Exchange) [mailto:mbraten@BEAR.COM]
> > Sent: Thursday, May 02, 2002 4:00 PM
> > To: SAS-L@LISTSERV.UGA.EDU
> > Subject: Re: Last non-Blank value
> >
> >
> > Here's my take on it:
> >
> >
> > data oset;
> > set iset;
> > array months {12} $ 20 dec02 noc02 .................. ;
> >
> > do i = 1 to dim(months) ;
> > if months(i) ne ' ' then prv= months(i) ;
> > leave;
> > end;
> >
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Sheila Whitelaw [SMTP:sw75@BOXFROG.COM]
> > > Sent: Thursday, May 02, 2002 2:24 PM
> > > To: SAS-L@LISTSERV.UGA.EDU
> > > Subject: Last non-Blank value
> > >
> > > Hi, I need to assign a variable with the last non-blank value of
> > > monthly variables. I have the following code that works fine. I just
> > > wonder if there is a more efficient way to do it.
> > >
> > > data oset;
> > > set iset;
> > > if dec02^='' then prv=dec02;
> > > else if nov02^='' then prv=nov02;
> > > else if oct02^='' then prv=oct02;
> > > else if sep02^='' then prv=sep02;
> > > else if aug02^='' then prv=aug02;
> > > else if jul02^='' then prv=jul02;
> > > else if jun02^='' then prv=jun02;
> > > else if may02^='' then prv=may02;
> > > else if apr02^='' then prv=apr02;
> > > else if mar02^='' then prv=mar02;
> > > else if feb02^='' then prv=feb02;
> > > else if jan02^='' then prv=jan02;
> > > run;
> > >
> > > Thanks for any suggestion.
> >
> >
> > ****************************************************************
> > Bear Stearns is not responsible for any recommendation, solicitation,
> > offer or agreement or any information about any transaction, customer
> > account or account activity contained in this communication.
> > ***********************************************************************
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
|