COUNT var_name = var... (value...). Each value takes one of the following forms: number string num1 THRU num2 MISSING SYSMIS In addition, num1 and num2 can be LO or LOWEST, or HI or HIGHEST, respectively.
COUNT creates or replaces a numeric target variable that counts the occurrence of a criterion value or set of values over one or more test variables for each case.
The target variable values are always nonnegative integers. They are never missing. The target variable is assigned an F8.2 output format. See Input and Output Formats. Any variables, including long and short string variables, may be test variables.
User-missing values of test variables are treated just like any other values. They are not treated as system-missing values. User-missing values that are criterion values or inside ranges of criterion values are counted as any other values. However (for numeric variables), keyword MISSING may be used to refer to all system- and user-missing values.
COUNT target variables are assigned values in the order
specified. In the command
COUNT A=A B(1) /B=A B(2)., the
following actions occur:
Ais assigned this value.
Band the new value of
Bis assigned this value.
Despite this ordering, all COUNT criterion variables must exist before the procedure is executed—they may not be created as target variables earlier in the command! Break such a command into two separate commands.
The examples below may help to clarify.
Q9are numeric variables, the following commands:
COUNT QCOUNT=Q0 TO Q9(1). DESCRIPTIVES QCOUNT /STATISTICS=SUM.
QVALIDby 10 to obtain a percentage of valid values, using COMPUTE. See COMPUTE, for details.
COUNT QVALID=Q0 TO Q9 (LO THRU HI). COMPUTE QVALID=QVALID*10. DESCRIPTIVES QVALID /STATISTICS=MEAN.