## SAS missing values .S, .R, .D

Solved
Regular Contributor
Posts: 150

# SAS missing values .S, .R, .D

I have a SAS data transport file that was exported from QDS. I made missing values have several codes including .S for skipped, .D for don't know, and .N for not applicable. For recoding purposes, when I am creating new variables so I have to recode .S, .D, .N, and just regular missing, .,  separately? I thought I could just make sure I recoded missing, . , and that would take them into account but that does not seem to be happening.

Any help would be greatly appreciated!

Accepted Solutions
Solution
‎03-11-2014 05:29 PM
Super User
Posts: 8,089

## Re: SAS missing values .S, .R, .D

All missing values are less than any valid number.  So you can use ranges to select them in comparisons or format definition.  You can also use the MISSING() function.

Here is a little program to show you the relative order of the special missing values.

data test ;

missing _ a z ;

input x @@;

cards;

1 2 . _ A Z

run;

proc sort; by x; run;

data _null_; set ; by x;

put x @@ ;

run;

_ . A Z 1 2

So you could code:

if x <= .Z then ...

if missing(x) then ...

All Replies
Solution
‎03-11-2014 05:29 PM
Super User
Posts: 8,089

## Re: SAS missing values .S, .R, .D

All missing values are less than any valid number.  So you can use ranges to select them in comparisons or format definition.  You can also use the MISSING() function.

Here is a little program to show you the relative order of the special missing values.

data test ;

missing _ a z ;

input x @@;

cards;

1 2 . _ A Z

run;

proc sort; by x; run;

data _null_; set ; by x;

put x @@ ;

run;

_ . A Z 1 2

So you could code:

if x <= .Z then ...

if missing(x) then ...

Regular Contributor
Posts: 150

## Re: SAS missing values .S, .R, .D

Thank you. This definitely help. I had originally had if x > . then ... but that was recoding the .S missing into categories. I will try to use if x > .Z then ... and see if that works.

🔒 This topic is solved and locked.