Differences between revisions 2 and 3
Revision 2 as of 2023-06-09 17:50:30
Size: 1243
Comment:
Revision 3 as of 2023-06-11 20:45:23
Size: 1369
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 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.

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.


CategoryRicottone

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