|
dear Neal,
I'm not sure, wether there is an more elegant way, but it works if you
create a view before. The combination of obs= and keep= is no problem.
proc sql;
create view SUBSET as
select *
from ADLT1
where sex = 'F';
run;
proc print data=SUBSET (obs=2000 keep=sex);
run;
Greetings from Germany. Heide
-----Original Message-----
From: Neal K Nair [mailto:nnair@ACF.DHHS.GOV]
Sent: Wednesday, July 11, 2001 3:07 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Selection of cases within a procedure
Dear colleagues:
This is probably impossible, but I thought I would raise my question in this
ingenious forum.
I have to run several Proc Print procedures on a data set that contains over
96,000 observations and over 30 variables. For each Proc Print, I select
the
variables I want to print (using KEEP=) and state a condition for selection
using the WHERE clause. For a couple of the Proc Print procedures, however,
I want to select the first 2000 observations from the data set, primarily to
limit the printing to a manageable number of cases. I read somewhere in the
manual that the OBS= and the WHERE clause do not go together. Is there a
way
to accomplish this? Below is sample of my program (part only).
PROC PRINT DATA=ADLT1 (KEEP=AGE SEX EDUCN) NOOBS N WIDTH=MIN;
WHERE AGE LE 18 AND SEX ='F';
VAR AGE SEX EDUCN;
I want to do the printing only on the first 2000 observations. I tried _N_
LE 2000 as part of the WHERE clause, but, as you know, that produced an
error
message. I found out that OBS= and the KEEP= statements also do not go
together. I am trying to avoid creating another data set with the first
2000
observations just for these couple of procedures. Is there a way, or is it
a
wishful thinking on my part?
Thanks in advance for any helpful suggestions.
Neal
|