BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Say you want to make a table of a bunch of variables in proc tabulate. The variables have different numbers of missing values for each variable. It seems like proc tabulate will only include records which have nonmissing values for ALL the variables. Or if you use the 'missing' option, it will include all values for all variables, including missing values (which I don't want displayed). Does anyone know of a way to display ONLY the nonmissing values for each variable? In other words, the n for each variable may vary from variable to variable.
Thanks.
1 REPLY 1
mftuchman
Quartz | Level 8
Are you asking how to get proc tabulate to compute means based only on the non-missing values?

data example;
infile datalines;
input a1-a6;
datalines;
1 . . 1 1 1
1 1 0 0 1 1
. 0 1 1 . 1
. 0 1 . 1 1
. . 1 . 1 1
;

proc tabulate;
var a1 a2 a3 a4 a5 a6;
table (sum mean n nmiss), a1 a2 a3 a4 a5 a6;
run;

This seems to calculate means based on only the non-missing values. Or did you mean something else?

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 909 views
  • 0 likes
  • 2 in conversation