BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bullfrog
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

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

2 REPLIES 2
LinusH
Tourmaline | Level 20

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
ScottBass
Rhodochrosite | Level 12

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.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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