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

I have a dataset ds1. I want to have a list, that shows me how many missing values there is per (numeric) variabel. I know I can get this by simply using a proc means: 

 

data ds1;
input kon $ age ss;
cards;
M 20 1
K 22 2
M 24 2
M . .
K . .
. . .
;
run;

 

proc means data=ds1 NMISS N;
run;

 

But is it possibel to get the exact result output  (se attachments) I get from the proc means into a actual dataset, so I use that for further analysis? I want to use it to calcute late the response rate for each variabel/question. 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Okay How about proc freq nlevels

 

data ds1;
input kon $ age ss;
cards;
M 20 1
K 22 2
M 24 2
M . .
K . .
. . .
;
run;
  ods output nlevels=want;
  proc freq data=ds1 nlevels;
     tables  age ss / noprint;
  run;

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Are you asking for OUTPUT OUT statement in proc means?

 



data ds1;
input kon $ age ss;
cards;
M 20 1
K 22 2
M 24 2
M . .
K . .
. . .
;
run;

 

proc means data=ds1 NMISS N;
output out=want nmiss= n=/autoname;
run;
Biniie
Fluorite | Level 6

Well, not exactly. The output out function gives me the type of data, that I need, but I would like to have one row per variabel, that contains the number of missing and non-missing values for each variabel - just like the "plot" you get in the result window (or see the attached file) when you run the proc means statement. 

novinosrin
Tourmaline | Level 20

Okay How about proc freq nlevels

 

data ds1;
input kon $ age ss;
cards;
M 20 1
K 22 2
M 24 2
M . .
K . .
. . .
;
run;
  ods output nlevels=want;
  proc freq data=ds1 nlevels;
     tables  age ss / noprint;
  run;

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
  • 3 replies
  • 613 views
  • 0 likes
  • 2 in conversation