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 (July 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Jul 2002 15:51:06 -0500
Reply-To:     greg.woolridge@TAP.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Greg  Woolridge <greg.woolridge@TAP.COM>
Subject:      Re: A datastep question...
Comments: To: Witness <bmeyer67@CALVIN.EDU>
Content-type: text/plain; charset=us-ascii

The problem is that SAS needs the variable in the data vector in order for the WHERE to execute. You might try using DROP= on your output data set as in:

DATA Inputdata (drop=ID3); SET ...;

I have not tried this before, so I am not sure that it will work, but it is the only way I can think of to possibly do what you want in a single DATA step.

Greg M. Woolridge Manager, Study Programming TAP Pharmaceutical Products Inc. e-mail: phone: 847-582-2332 fax: 847-582-2403

Witness <bmeyer67@CALVIN To: SAS-L@LISTSERV.UGA.EDU .EDU> cc: Sent by: "SAS(r) Subject: A datastep question... Discussion" <SAS-L@LISTSERV. UGA.EDU>

07/10/02 03:39 PM Please respond to Witness

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.


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.



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.)


Benjamen R. Meyer

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