Date: Thu, 4 Feb 1999 11:33:45 GMT
Reply-To: David Booth <dkb@CIX.COMPULINK.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: David Booth <dkb@CIX.COMPULINK.CO.UK>
Organization: Compulink Information eXchange
Subject: Re: Changing the value of last obs in a Dataset
Ignatius Esele asks:
> How can I change the value of last observation in a DATASET?
>
> DATA XX;
> SET YY;
> BY IDG;
> Z = 1;
> IF LAST.IDG THEN Z = 2;
> RUN;
> I want Z=2 only for the last observation. This does not seem to work.
> Thanks.
> Ignatius.
Use the end= option to set a variable to 1 when the last record is read:
DATA XX;
SET YY end=the_end;
IF the_end THEN Z = 2;
else Z = 1;
RUN;
Dave
.
|