Date: Wed, 9 Jun 2010 14:04:17 +0200
Reply-To: karma <dorjetarap@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: karma <dorjetarap@GOOGLEMAIL.COM>
Subject: Re: Drop a renamed variable using the drop statement
In-Reply-To: <201006091100.o59AumuK004980@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Hi Scott,
The order or execution is drop then rename. In your first example you
are trying to rename a variable that doesn't exist, and in the second
example you are trying to drop a variable that doesn't exist (as it
hasn't been renamed yet).
The only ways I can think of to change this order is on the datastep
options (i.e renaming on the set statement or dropping on the data
statement). But why do you want to drop a renamed variable anyway? In
both examples you have given, removing the drop statement leaves a
dataset without the foo variable as it is being renamed.
Karma
On 9 June 2010 13:00, Scott Bass <sas_l_739@yahoo.com.au> wrote:
> Hi,
>
> I have a utility macro called by a wrapper macro. The utility macro creates
> data step variables that I want to drop in the wrapper macro.
>
> Here is simplified code:
>
> data test;
> length foo 8;
> rename foo=bar;
> foo=1;
> drop foo;
> run;
>
> This results in a warning. So, trying this:
>
> data test;
> length foo 8;
> rename foo=bar;
> foo=1;
> drop bar;
> run;
>
> This results in the same warning.
>
> Is there a way to drop foo from the final dataset using a drop statement?
>
> Thanks,
> Scott
>
|