SPSS CasesToVars

The CASESTOVARS command translates a long dataset into wide format. See also VARSTOCASES.


Usage

casestovars
  /id=clientid
  /index=fiscalquarter.

The new variables will be named like Sales.1, Sales.2, and so on for each value of fiscalquarter. If the /INDEX subcommand was not specified, variables will be spread into an unknowable number of sequentially-named variables.

The dataset must be pre-sorted by all variables named on the /ID and /INDEX subcommands (in that order).

Fixed

If a variable is constant within the group, they should be marked as a fixed variable so that it isn't spread. These can be marked explicitly on the /FIXED subcommand.

casestovars
  /id=clientid
  /index=fiscalquarter
  /fixed=clientpoc.

SPSS also attempts to identify fixed variables automatically, and by default will mark them as such. Add the /AUTOFIX=YES subcommand to explicitly allow this behavior, or add the /AUTOFIX=NO subcommand to disable it.


Data Model

The CASESTOVARS command recognizes SPLIT FILE status. The dataset must additionally be sorted by the split variables with the highest priority.

The CASESTOVARS command also recognizes WEIGHT status and preserves it.

The CASESTOVARS command does not recognize FILTER status.


CategoryRicottone

SPSS/CasesToVars (last edited 2023-06-11 21:15:00 by DominicRicottone)