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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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