COUNT subcommand (CASESTOVARS command)

CASESTOVARS consolidates row groups in the original data into a single row in the new data file. The COUNT subcommand creates a new variable that contains the number of rows in the original data that were used to generate the row in the new data file.

  • One new variable is named on the COUNT subcommand. It must have a unique name.
  • The label for the new variable is optional and, if specified, must be delimited by single or double quotes.
  • The format of the new count variable is F4.0.

Example

If the original data are as shown in the first example, the commands:

SPLIT FILE BY insure.
CASESTOVARS
	/ID=caseid
	/COUNT=countvar
	/DROP=insure month bpd.

create a new file with the following data:

  • The command created a count variable, countvar, which contains the number of rows in the original data that were used to generate the current row.