BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tommer
Obsidian | Level 7

Hi,

Is it possible to get N=0 when there are zero observations in a dataset?

Ex: 

data cls;
set sashelp.class;
age=0;
if age ne 0;
run;

 

In the below, the output dataset is empty. Instead if I want to see N=0 indicating there are no records in a dataset, how can I do?

 

proc means data=cls stackodsoutput;
var age;
output out=cl_m;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Statistical procedures need at least one row of data to report on, even if all variable values are missing. Zero rows means no statistics.

 

If you want to report on zero row tables then PROC CONTENTS is a better option:

 

SASKiwi_0-1679612252455.png

 

View solution in original post

1 REPLY 1
SASKiwi
PROC Star

Statistical procedures need at least one row of data to report on, even if all variable values are missing. Zero rows means no statistics.

 

If you want to report on zero row tables then PROC CONTENTS is a better option:

 

SASKiwi_0-1679612252455.png

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 524 views
  • 0 likes
  • 2 in conversation