COUNTN (x <, method> );
The COUNTN function counts the number of nonmissing values in a matrix. The arguments are as follows:
specifies an numerical or character matrix. The COUNTN function counts the number of nonmissing values in this matrix.
specifies the method used to count the nonmissing values. This argument is optional. The following are valid values:
specifies that all nonmissing values are counted. This is the default value. The function returns a matrix.
specifies that the function return an matrix whose ith element is the number of nonmissing values in the ith row of x.
specifies that the function return a matrix whose jth element is the number of nonmissing 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 nonmissing values for a matrix x
:
x = {1 2 3, . 0 2, 1 . ., 1 0 . }; totalN = countn(x); rowN = countn(x, "ROW"); colN = countn(x, "COL"); print totalN, rowN, colN;