INDEX subcommand (CASESTOVARS command)

In the original data, a variable appears in a single column. In the new data file, that variable will appear in multiple new columns. The INDEX subcommand names the variables in the original data that should be used to create the new columns. INDEX variables are also used to name the new columns.

Optionally, with the GROUPBY subcommand, INDEX variables can be used to determine the order of the new columns, and, with the VIND subcommand, INDEX variables can be used to create indicator variables.

  • String variables can be used as index variables. They cannot contain blank values for rows in the original data that qualify for inclusion in the new data file.
  • Numeric variables can be used as index variables. They must contain only non-negative integer values and cannot have system-missing or blank values.
  • Within each row group in the original file, each row must have a different combination of values of the index variables.
  • If the INDEX subcommand is not used, the index starts with 1 within each row group and increments each time a new value is encountered in the original variable.
  • Variables listed on the INDEX subcommand may not appear on the ID, FIXED, or DROP subcommands.
  • Index variables are not are not candidates to become a variable group in the new data file.