Date: Wed, 10 Jul 2002 18:46:14 -0400
Reply-To: Jan Padilla <jan.padilla@MINDSPRING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jan Padilla <jan.padilla@MINDSPRING.COM>
Subject: Re: A datastep question...
If you put the keep option on the output dataset, you don't need to keep
the variables used for subsetting.
DATA InputData(KEEP=ID1 ID2);
On Wed, 10 Jul 2002 16:39:00 -0400, Witness <bmeyer67@CALVIN.EDU> wrote:
>Well, not necessarily a datastep, but...
>I have been starting to use WHERE clauses in set statements to limit my
>data instead of using the subsetting-IF. However, I still find that I
>need to have the COLUMN that I am using in the WHERE clause to in order
>to run the step.
> SET DB.Input(KEEP=ID1 ID2 ID3 WHERE=(ID3=&X);
>If I needed ID3 later on, then I wouldn't mind having to have it in the
>returned columns. However, I don't and it takes up space. (I remove it
>at the next time that I subset my data, such as a PROC MEANS procedure.)
>Now, if I were to implement this SQL, I don't need to have the column
> CREATE TABLE InputData AS
> SELECT ID1,ID2 FROM DB.Input WHERE ID3=&X;
>Is there some way that with the DATA step's (or PROCs if it were to be
>done there) that I could drop a column but use it in the WHERE?
>Note: This is not a question of SAS vs. SQL. But a question of SAS in
>how to do it, or why can't it be done? If I were worried about space,
>the SQL may be more appealing even though it takes a little longer to
>run, at least in my test scenario from one of my scripts. (Difference in
>time is 8.57 seconds real time, and 9.98 seconds CPU time. That also
>includes a sort, and the data step is done through a PROC SORT
>Benjamen R. Meyer