Language Reference |
COUNTUNIQUE Function |
The COUNTUNIQUE function counts the number of unique values in a matrix. The arguments are as follows:
specifies an numerical or character matrix. The COUNTUNIQUE function counts the number of unique values in this matrix.
specifies the method used to count the missing values. This argument is optional. The following are valid values:
specifies that the function counts all unique values in the matrix. This is the default value. The function returns a matrix.
specifies that the function counts the unique values in each row. The function returns an matrix whose th element is the number of unique values in the th row of x.
specifies that the function counts the unique values in each column. The function returns a matrix whose th element is the number of unique values in the th column 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 unique values for the matrix x:
x={1 2 3, 1 1 2, 1 1 1, 1 0 0}; allUnique = countunique(x); rowUnique = countunique(x, "ROW"); colUnique = countunique(x, "COL"); print allUnique, rowUnique, colUnique;
Copyright © SAS Institute, Inc. All Rights Reserved.