Previous Page | Next Page

Missing Values

Order of Missing Values


Numeric Variables

Within SAS, a missing value for a numeric variable is smaller than all numbers; if you sort your data set by a numeric variable, observations with missing values for that variable appear first in the sorted data set. For numeric variables, you can compare special missing values with numbers and with each other. Numeric Value Sort Order shows the sorting order of numeric values.

Numeric Value Sort Order
Sort Order Symbol Description
smallest ._ underscore

. period

.A-.Z special missing values A (smallest) through Z (largest)

-n negative numbers

0 zero
largest +n positive numbers

For example, the numeric missing value (.) is sorted before the special numeric missing value .A, and both are sorted before the special missing value .Z. SAS does not distinguish between lowercase and uppercase letters when sorting special numeric missing values.

Note:   The numeric missing value sort order is the same regardless of whether your system uses the ASCII or EBCDIC collating sequence.  [cautionend]


Character Variables

Missing values of character variables are smaller than any printable character value. Therefore, when you sort a data set by a character variable, observations with missing (blank) values of the BY variable always appear before observations in which values of the BY variable contain only printable characters. However, some usually unprintable characters (for example, machine carriage-control characters and real or binary numeric data that have been read in error as character data) have values less than the blank. Therefore, when your data includes unprintable characters, missing values might not appear first in a sorted data set.

Previous Page | Next Page | Top of Page