LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 7 May 2009 11:41:38 -0400
Reply-To:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:   Re: Dropping variables efficiently

Hi Mike, think a view does nearly that what you mean. It does nothing while creation, only when using that dataset. Gerhard

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 ... > >Mike Rhoads > > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of karma >Sent: Thursday, May 07, 2009 10:09 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Dropping variables efficiently > > >Proc SQL's alter table should be more efficient: > >proc copy in=sashelp out=work ; > select class ; > run ; >proc sql; > alter table class > drop name ; > quit ; > >log: >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 <>: >> Is there a more efficient way to drop variables than the obvious? >> >> data a; >> set b (drop = x y); >> run; >>

Back to: Top of message | Previous page | Main SAS-L page