Date: Fri, 15 Jan 1999 10:28:06 -0500
Reply-To: "John T. Jones" <jonesj@PHARMARESEARCH.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "John T. Jones" <jonesj@PHARMARESEARCH.COM>
Subject: Re: Reordering variables in a new data set
Content-Type: text/plain; charset="us-ascii"
Thank you John,
I have had problems using this method before though.
Do you know what that might be? I wanted to be careful
when I suggested the retain staement.
jj
At 03:07 PM 1/15/99 +0000, you wrote:
>At 09:15 15/01/99 -0500, John T. Jones wrote:
>
>>2. data new;
>> retain var1 var2;
>> set old;
>> run;
>> Caution: retain will hold last not missing
>> value over iterations of missing.
>> If have no missing then this is simplest.
>
>John, the 'caution' is unnecessary - and, in fact, not true. The previous
>value of RETAINed variables is only RETAINed until a new value (*even*
>'missing') is assigned - e.g. by a SET statement. Despite all the myths and
>concerns, there are NO situations in which the code you have written will
>not work as intended. The only thing you could do wrong would be to include
>a variable in the RETAIN statement that did not exist in the dataset being
>SET - but that would merely result in that 'new' variable being added to the
>dataset with all values set to missing.
>
>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
>----------------------------------------------------------------
>
|