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

Hello everybody,

I have a dataset of this kind:

data have;                    
input var;
datalines; 
34
54
.a
.b
65
.b
; 

As you can see I have different kinds of missing values identified with "A" and "B".

I would like to know how many A and B missing values are there:

e.g. A: 1; B: 2

Does anybody know how?

 

Thank you very much!

 

SAS Version: 9.4

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

You can use Proc Summary with the Missing Option like this. The _FREQ_ Variables gives you the answer.

 

data have;                    
input var;
datalines; 
34
54
.a
.b
65
.b
; 

proc summary data = have missing nway;
   class var;
   output out=want;
run;

  

Result:

 

Obs  var  _TYPE_  _FREQ_ 
1    A    1       1 
2    B    1       2 
3    34   1       1 
4    54   1       1 
5    65   1       1 

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

You can use Proc Summary with the Missing Option like this. The _FREQ_ Variables gives you the answer.

 

data have;                    
input var;
datalines; 
34
54
.a
.b
65
.b
; 

proc summary data = have missing nway;
   class var;
   output out=want;
run;

  

Result:

 

Obs  var  _TYPE_  _FREQ_ 
1    A    1       1 
2    B    1       2 
3    34   1       1 
4    54   1       1 
5    65   1       1 
FreelanceReinh
Jade | Level 19

Hello @riccardo88,

 

Or use PROC FREQ:

proc freq data=have;
tables var / missing;
run;

You can restrict the counts to missing values by adding a WHERE statement to this step, e.g.

where missing(var);

 

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