An IML numeric element can have a special value called a missing value that indicates that the value is unknown or unspecified. (A matrix with missing values should not be confused with an empty or unvalued matrix—that is, a matrix with 0 rows and 0 columns.) A numeric matrix can have any mixture of missing and nonmissing values.
SAS/IML software supports missing values for certain operations. The operators in the following list recognize missing values and propagate them. For example, matrix multiplication of a matrix with missing values is not supported. Most matrix operators and functions do not support missing values. Furthermore, many linear algebraic operations are not mathematically defined for a matrix with missing values. For example, the inverse of a matrix with missing values is meaningless.
Missing values are coded in the bit pattern of very large negative numbers, as an IEEE "NAN" code, or as a special string, depending on the host system.
In literals, a numeric missing value is specified as a single period. In data processing operations, you can add or delete missing values. All operations that move values around move missing values properly. The following arithmetic operators propagate missing values.
addition () |
subtraction () |
|
multiplication (#) |
division (/) |
|
maximum () |
minimum () |
|
modulo (MOD) |
exponentiation (##) |
The comparison operators treat missing values as large negative numbers. The logical operators treat missing values as zeros. The operators SUM, SSQ, MAX, and MIN check for and exclude missing values.
The subscript reduction operators exclude missing values from calculations. If all of a row or column that is being reduced is missing, then the operator returns the result indicated in the following table.
Operator |
Result If All Missing |
|
---|---|---|
addition () |
0 |
|
multiplication (#) |
1 |
|
maximum () |
large negative value |
|
minimum () |
large positive value |
|
sum squares (##) |
0 |
|
index maximum () |
1 |
|
index minimum () |
1 |
|
mean (:) |
missing value |
Also note that, unlike the SAS DATA step, IML does not distinguish between special and generic missing values; it treats all missing values alike.