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.
create view SUBSET as
where sex = 'F';
proc print data=SUBSET (obs=2000 keep=sex);
Greetings from Germany. Heide
From: Neal K Nair [mailto:nnair@ACF.DHHS.GOV]
Sent: Wednesday, July 11, 2001 3:07 PM
Subject: Selection of cases within a procedure
This is probably impossible, but I thought I would raise my question in this
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
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
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
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
observations just for these couple of procedures. Is there a way, or is it
wishful thinking on my part?
Thanks in advance for any helpful suggestions.