|
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.
***********************************************************************
|