Date: Sun, 3 Aug 2008 20:47:16 -0700
Reply-To: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject: Re: dropping one variable from a huge dataset without recreating
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Aside from speed (which I haven't tested) and ease of use, the ALTER
TABLE approach has another advantage: it will preserve the SORTEDBY
attribute, indexes, and constraints.
proc sort data=sashelp.class out=class (index=(name));
alter table class
proc contents data=class;
The listing will contain, among other things:
Alphabetic List of Indexes and Attributes
# Index Values
1 Name 19
Character Set ANSI
A data step approah would require much more work if you wanted to
preserve these attributes.
On Aug 3, 2008, at 7:58 pm, Chan Rajaram wrote:
> Thanks all!
> On the same note what would be fastest way to recreate a
> the variable in question)? Its not for my use so the view is out of
> question so it needs to be a dataset.
> I can use this simple code to do what I need
> data xyz;
> set xyz(drop = vartobedropped);
> Like Howard was saying is this any faster?
> proc sql;
> alter table xyz;
> drop vartobedropped;
> proc append base=abc data=xyz(drop=vartobedropped);
> Then I can delete xyz and rename abc to xyz.
> Which of the above three is faster? I know append usually works well
> concatanating datasets(especially for temporary datasets from one of
> SUGI papers I have read) as it reads just the base dataset compared
> to a
> set statement which has to read all the datasets
> Let me know if you guys have been in a situation like this (copying
> dataset) and have used something that's been tried/tested and has been
> faster compared to others?