DATA Step, Macro, Functions and more

%sysfunc(open(dataset)) using where clause doesn't seem to filter

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

%sysfunc(open(dataset)) using where clause doesn't seem to filter

Hello:  Can someone help explain to me why this codeset returns a value of 19, instead of 9?  For some reason, it's not applying my where clause as I'd expect.

%let dsid = %sysfunc(open(sashelp.class (where=(Sex="F"))));

%let Gender_NOBS =%sysfunc(attrn(&dsid,NOBS));

%let rc = %sysfunc(close(&dsid));

%put Gender Count =  &Gender_NOBS;

Thanks!


Accepted Solutions
Solution
‎09-30-2013 05:46 PM
Super User
Posts: 5,255

Re: %sysfunc(open(dataset)) using where clause doesn't seem to filter

From online doc:

NOBS

specifies the number of physical observations (including the observations that are marked for deletion). An active WHERE clause does not affect this number.

Data never sleeps

View solution in original post


All Replies
Solution
‎09-30-2013 05:46 PM
Super User
Posts: 5,255

Re: %sysfunc(open(dataset)) using where clause doesn't seem to filter

From online doc:

NOBS

specifies the number of physical observations (including the observations that are marked for deletion). An active WHERE clause does not affect this number.

Data never sleeps
Super Contributor
Posts: 376

Re: %sysfunc(open(dataset)) using where clause doesn't seem to filter

I've attached a macro I use to determine the number of observations for various scenarios.  Perhaps you'll find it useful.  You'll have to modify it to remove the call to %parmv.

Attachment
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 302 views
  • 0 likes
  • 3 in conversation