think a view does nearly that what you mean. It does nothing while
creation, only when using that dataset.
On Thu, 7 May 2009 10:30:22 -0400, Mike Rhoads <RHOADSM1@WESTAT.COM> wrote:
>Interesting. For SAS data sets, AFAIK dropping columns requires the
creation of a new instance of the data set, meaning that all records must
be read and then rewritten. Thus I suspect that, when benchmarked with a
sufficiently large data set, the SQL ALTER approach would not be
significantly faster than the original DATA step approach.
>I can't think of any reason why SAS couldn't implement a "logical drop"
for variables, similar to the way you can logically get rid of a record
with the REMOVE statement. The variable would still be in the data
portion of the SAS data set, but it would be effectively removed from the
header section so that it is no longer accessible from SAS. This would be
considerably faster, but of course would not reduce the size of the data
set if that is the objective.
>Maybe there will be such an option in a future version ...
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of karma
>Sent: Thursday, May 07, 2009 10:09 AM
>Subject: Re: Dropping variables efficiently
>Proc SQL's alter table should be more efficient:
>proc copy in=sashelp out=work ;
> select class ;
> run ;
> alter table class
> drop name ;
> quit ;
>219 proc sql;
>220 alter table class
>221 drop name ;
>NOTE: Table WORK.CLASS has been modified, with 4 columns.
>222 quit ;
>NOTE: PROCEDURE SQL used:
> real time 0.00 seconds
> cpu time 0.00 seconds
>2009/5/7 Paul <email@example.com>:
>> Is there a more efficient way to drop variables than the obvious?
>> data a;
>> set b (drop = x y);