Aaraeus
Aaraeus

Reputation: 1155

Is there a way of identifying special missing values in a proc format in SAS?

I have something similar to the following code going on:

 proc format;
 ** for numeric variables;
 value missf
 . = ‘Missing’
 other = ‘Non-Missing’
 ;

 ** for character variables;
 value $missf
 ‘ ‘ = ‘Missing’
 other = ‘Non-Missing’
 ;
 run;

 proc freq data=rawds;
 table _all_ / missing;
 format _character_ $missf. _numeric_ missf.;
 run; 

As you can see, we have the format missf for numeric values. However, my data has special missing values (.A, .B, .C, etc), which currently don't get flagged as missing because the format missf only looks for ..

I understand I could just add more rows into the proc format, i.e. do something like this, but it feels inefficient:

. = 'Missing'
.a = 'Missing'
.b = 'Missing'
.c = 'Missing'
...
.A = 'Missing'
...
.Z = 'Missing'

Is there a way of adding in special missing values without having to write 52 lines of code (26 lower case letters, 26 upper case letters)?

Upvotes: 1

Views: 502

Answers (1)

Tom
Tom

Reputation: 51566

Missing values have an order ._ is the smallest, then regular missing, ., and then .A to .Z.

value missf ._-.z = 'Missing' other='Non-missing' ;

Or you could use LOW-HIGH range to capture the non-missing values and the OTHER case for the missing values.

value missf low-high='Non-missing' other='Missing';

Upvotes: 2

Related Questions