The TABULATE subroutine counts the number of elements in each of the unique categories of the x argument.
The output arguments are as follows:
contains the unique sorted elements of the x argument. See also the UNIQUE function.
contains the number of elements of x that match each element of levels.
The input arguments are as follows:
specifies a vector of values.
specifies whether missing values are included in the analysis. The following values are valid:
specifies that missing values are excluded from the analysis. This is the default value for the option.
specifies that missing values are counted as a valid separate level.
The method argument is not case-sensitive. The first two characters are used to determine the value. For example, “MISS” and “missing” specify the same option.
The following statements demonstrate the TABULATE subroutine:
x = {C, A, B, A, C, A};
call tabulate(labels, freq, x);
print freq[colname=labels];
x = {C, A, B, " ", A, C, A, " "};
call tabulate(labels, freq, x, "Missing");
labels = "Missing" || remove(labels, 1);
print freq[colname=labels];