Date: Thu, 11 Jul 2002 14:21:02 +0200
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: A datastep question...
Content-Type: text/plain
Hi Benjamen and Jan,
And take care to put an additional matching closing parentheses after the
WHERE option.
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
On the average the weather here is quite nice. It either is too warm or too
cold.
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery
can be arranged.
> -----Original Message-----
> From: Jan Padilla [SMTP:jan.padilla@MINDSPRING.COM]
> Sent: Thursday, July 11, 2002 12:46 AM
> To: SAS-L@LISTSERV.UGA.EDU
> 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);
> SET DB.Input(WHERE=(ID3=&X);
> RUN;
>
> 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.
> >
> >Example:
> >
> >DATA InputData;
> > SET DB.Input(KEEP=ID1 ID2 ID3 WHERE=(ID3=&X);
> > RUN;
> >
> >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
> >ID3 there.
> >
> >Example:
> >
> >PROC SQL;
> > CREATE TABLE InputData AS
> > SELECT ID1,ID2 FROM DB.Input WHERE ID3=&X;
> > QUIT;
> >
> >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
> >statement.)
> >
> >Thanks,
> >
> >Benjamen R. Meyer
|