BookmarkSubscribeRSS Feed

To show missing values as NA, it would be nice if we could do the following. It's easy to workaround this, but given that NA is common in other packages this would be a useful addition. 

 

options missing='NA';

data class;
set sashelp.class;
if age=12 then call missing(age, weight);
if age=13 then call missing(height);
run;

proc print data=class;
run;

 

 

4 Comments
ballardw
Super User

Sincee the definition of the missing is a single character I doubt that SAS is going to make such a change.

 

However formats will do that though you would need one for character and another for numeric:

 

proc format;

value mymiss

. = 'NA';

run;

 

proc print data=class;

   format _numeric_ mymiss.;

run;

Reeza
Super User

Maybe. But they made that definition and can change it, I think consistency across applications is nice to implement. 

Yes, a nested format can be used in place but that's annoying when you have multiple formats, ie currency, time that you'd all like treated in a similar fashion. 

 

 

PGStats
Opal | Level 21

I guess you would have to propose a similar change to the missing statement, so that missing values that can be output as NA could also be read back as missing.

Quentin
Super User

@PGStats I don't think it would need to be added to the missing statement.  That would require (I think) allowing numeric special missing values to be more than one character, which I'm guessing would be a big change.   If you're reading data with "NA" or "Missing" or "Null", I think it's fair for you to have to code your own informat, or deal with it some other way. 

 

But the ability using the missing option to have a numeric missing value displayed as "NA" or "Missing" instead of "." seems like it should be fairly simple.  I wonder if the mising option is using a hidden format in the background, somehow?