Language Reference


TABULATE Call

CALL TABULATE (levels, freq, x <, method> );

The TABULATE subroutine counts the number of elements in each of the unique categories of the x argument.

The output arguments are as follows:

levels

contains the unique sorted elements of the x argument. See also the UNIQUE function .

freq

contains the number of elements of x that match each element of levels.

The input arguments are as follows:

x

specifies a vector of values.

method

specifies whether missing values are included in the analysis. The following values are valid:

"nomissing"

specifies that missing values are excluded from the analysis. This is the default value for the option.

"missing"

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];

Figure 25.412: Frequencies of Levels

freq
A B C
3 1 2

freq
Missing A B C
2 3 1 2