Date: Tue, 9 Mar 1999 20:17:08 +0100
Reply-To: Bas Pruijn <bas.pruijn@CMG.NL>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Bas Pruijn <bas.pruijn@CMG.NL>
Subject: Re: carrying data forward
Content-Type: text/plain
I think I simplified a little to much. I have overlooked the subject part.
You're also right about the retain. Sorry for the reply without enough
thought.
> -----Original Message-----
> From: John Whittington [SMTP:medisci@POWERNET.COM]
> Sent: Tuesday, March 09, 1999 5:57 PM
> To: SAS-L@AKH-WIEN.AC.AT
> Subject: Re: carrying data forward
>
> At 17:19 09/03/99 +0100, Bas Pruijn wrote:
>
> >data outfil;
> > set infil;
> > retain var1 var2 var3;
> >run;
>
> Bas, unfortunately it's not as easy as that. All RETAIN does is stops the
> variables being 'reset to missing' at the 'top' of each iteration of the
> DATA step. The previous value will therefore only be RETAINed until such
> a
> time as a new value is assigned to the variable - in this case by the SET
> statement - at which point the variable will acquire the 'new' value, no
> matter what its value (even 'missing').
>
> Furthermore, even if RETAIN did what you prtesumably thought it did, your
> code would have potentially resulted in values being 'carried forward'
> from
> one subject to a totally different subject. I don't think there is any
> simpler way of achieving what is needed than the code I posted recently.
>
> Kind Regards,
>
> John
>
> ----------------------------------------------------------------
> Dr John Whittington, Voice: +44 (0) 1296 730225
> Mediscience Services Fax: +44 (0) 1296 738893
> Twyford Manor, Twyford, E-mail: medisci@powernet.com
> Buckingham MK18 4EL, UK mediscience@compuserve.com
> ----------------------------------------------------------------
|