Language Reference
COUNTMISS Function
COUNTMISS (x <, method> ) ;
This function is supported by the IML procedure and the iml action.
The COUNTMISS function counts the number of missing values in a matrix. The arguments are as follows:
- x
specifies an numerical or character matrix. The COUNTMISS function counts the number of missing values in this matrix.
- method
specifies the method used to count the missing values. This argument is optional. The following are valid values:
- "all"
specifies that all missing values are counted. This is the default value. The function returns a matrix.
- "row"
specifies that the function return an matrix whose ith element is the number of missing values in the ith row of x.
- "col"
specifies that the function return a matrix whose jth element is the number of missing values in the jth row of x.
The method argument is not case-sensitive. The first three characters are used to determine the value.
For example, the following statements count missing values for the matrix x:
x = {1 2 3,
. 0 2,
1 . .,
1 0 . };
totalMiss = countmiss(x);
rowMiss = countmiss(x, "ROW");
colMiss = countmiss(x, "COL");
print totalMiss, rowMiss, colMiss;
Figure 84: Counts of Missing Values
| totalMiss |
|---|
| 4 |
| rowMiss |
|---|
| 0 |
| 1 |
| 2 |
| 1 |
| colMiss | ||
|---|---|---|
| 1 | 1 | 2 |