Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2023-06-09 17:37:15
Size: 1253
Comment:
Revision 4 as of 2023-06-11 21:15:00
Size: 1545
Comment:
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
The dataset must be pre-sorted by all variables named on the `/ID` and `/INDEX` subcommands (in that order). If active, [[SPSS/SplitFile|SPLIT FILE]] will also impact this procedure. The dataset must be pre-sorted by all variables named on the `/ID` and `/INDEX` subcommands (in that order).
Line 25: Line 25:
=== Fixed Variables === === Fixed ===
Line 38: Line 38:
----



== Data Model ==

The `CASESTOVARS` command recognizes [[SPSS/SplitFile|SPLIT FILE]] status. The dataset must additionally be sorted by the split variables with the highest priority.

The `CASESTOVARS` command also recognizes [[SPSS/Weight|WEIGHT]] status and preserves it.

The `CASESTOVARS` command does ''not'' recognize [[SPSS/Filter|FILTER]] status.

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)