| Date: | Thu, 11 Aug 2005 15:59:33 -0400 |
| Reply-To: | Venky Chakravarthy <swovcc@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Venky Chakravarthy <swovcc@HOTMAIL.COM> |
| Subject: | Re: Arranging variables |
|
That is indeed true for newly created variables. However, Paolo's original
question in part read:
>>For example, if I want variable "revenue" to appear in my data set
>>before variable "costs"
It appears that he already has a data set. He only wants to rearrange
existing variables. Existing variables from a SET, MERGE, UPDATE or MODIFY
are automatically RETAINed. So an explicit RETAIN placed before any of the
above has no other purpose than reordering the variables in the PDV.
If you search the archives of SAS-L, you will find that this is not the
first time that this question has been asked. You will also find that this
is not the first time a solution involving RETAIN has been suggested.
On Thu, 11 Aug 2005 22:23:58 +0300, Vladislav <vladislav.moltchanov@KTL.FI>
wrote:
>Paolo ORIFICI wrote:
>
>> HI,
>>
>> How can I arrange variables in a SAS dataset. For example, if I want
variable "revenue" to appear in my data set before variable "costs" and so
on.
>>
>> Thanks,
>>
>> Paolo
>>
>Retain has nothing to do with ordering variables.
>When creating NEW data set the explicite Length statement defineds order
>of the variables.
>For example see code:
>
>data aaa; length zzz $ 3 b c 8;
>do b=1 to 10;
>zzz= put(b,3.);
>c=b**2;
>output;
>end;
>run;
>proc print;run;
>
>which produces printout:
>
> Obs zzz b c
>
> 1 1 1 1
> 2 2 2 4
> 3 3 3 9
> 4 4 4 16
> 5 5 5 25
> 6 6 6 36
> 7 7 7 49
> 8 8 8 64
> 9 9 9 81
> 10 10 10 100
|