Date: Mon, 13 Sep 2004 16:27:50 -0400
Reply-To: Don Henderson <donaldjhenderson@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don Henderson <donaldjhenderson@HOTMAIL.COM>
Subject: Re: the best way to drop vars
In-Reply-To: <B1EA9C6C7151EB42B242A4EFA0D0A71E04293A59@aaexchange01.HEALTH.AD>
Content-Type: text/plain; charset="us-ascii"
There is one distinction between KEEP and DROP that I have found to be of
value. Both of them work and do exactly what you want. However if you are in
an environment where the data sources are still being tweaked/refined (e.g.,
development of a data warehouse), I have come to prefer using the DROP
statement as it is easier to notice:
- variables that are there that shouldn't be (because they weren't DROPped)
vs.
- variables that are NOT there that should be (because you forgot to add
them to the KEEP list)
Again, let me emphasize that they both work. It is just a matter of which
type of oversight is more important to you.
Just my 2 cents.
Regards,
-don h
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Bruce
Johnson
Sent: Monday, September 13, 2004 2:49 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: the best way to drop vars
I agree that limiting on the fields that you want to keep on the SET
statement is one of the better ways. However, if you have a large
number of fields that you are dropping, maybe it would be better to KEEP
the fields you want. I don't know if there's definitive answer,
although there are lots of options.
________________________________
Bruce A. Johnson
bjohnson@solucient.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
DePuy, Venita
Sent: Monday, September 13, 2004 2:46 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: the best way to drop vars
These are two that I use:
Data file1;
*whatever else you are doing;
drop var1 var2;
run;
or
Data file2;
set file1 (drop var1 var2);
Although I certainly think that if you can do it at the same time you're
doing something else and avoid having to create a new data set merely
for the purpose of dropping variables, you're ahead of the game.
When I have huge datasets that I'm using for analyses, I try to limit
the variables when I first read it in to a working file; otherwise I
have more variables to wade thru when reading output etc. much less
bogging down the operations.
Good luck - I'm sure there's several more ways to drop variables. Venita
> ----------
> From: Igor Kurbeko[SMTP:ikurbeko@ATHEROGENICS.COM]
> Reply To: Igor Kurbeko
> Sent: Monday, September 13, 2004 3:41 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: the best way to drop vars
>
> Hi, folks.
>
>
>
> What's the best way to drop vars from a dataset.
>
>
>
> I use:
>
>
>
> data1(keep=var1-var10);
>
> set data1;
>
> run;
>
>
>
> But I think it slows perfomance.
>
>
>
> Thanks
>
>
>
> Igor Kurbeko
>
> Clinical Programmer Analyst
>
> 678 336 4328
>
> ikurbeko@atherogenics.com
>
>
>
> Imagination is more important than knowledge
>
>
>
This message is a private communication. It may contain information that is
confidential
and legally protected from disclosure. If you are not an intended recipient,
please do
not read, copy or use this message or any attachments, and do not disclose
them to others.
Please notify the sender of the delivery error by replying to this message,
and then
delete it and any attachments from your system.
Thank you,
Solucient LLC
(rev eXclaimer 2x)