⇤ ← Revision 1 as of 2023-06-09 17:50:28
Size: 1477
Comment:
|
Size: 1533
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 30: | Line 30: |
The '''`/INDEX`''' subcommand creates an index variable marking a created row's sequence within its group. | The '''`/INDEX`''' subcommand creates an index variable marking a created row's sequence within its group. This index variable will have an `F8.0` format. |
Line 38: | Line 38: |
To create an index variable that instead lists the ''name'' of the source variable variable, try: | To create an index variable that instead stores the string ''name'' of the source variable variable, try: |
SPSS VarsToCases
The VARSTOCASES command translates a wide dataset into long format. See also CASESTOVARS.
Contents
Usage
varstocases /make Sales from Sales.1 to Sales.4.
For each variable listed after FROM, a new row of data is created with that variable's value set instead into the /MAKE variable. All other variables are duplicated for each created row of data.
Id
The /ID subcommand creates a numeric variable storing the $casenum on the original, wide dataset. If the dataset already has an ID variable, it will automatically be duplicated to each created row of data, and the /ID subcommand won't offer any significant advantage over this.
Index
The /INDEX subcommand creates an index variable marking a created row's sequence within its group. This index variable will have an F8.0 format.
varstocases /make Sales from Sales.1 to Sales.4 /index=fiscalquarter.
To create an index variable that instead stores the string name of the source variable variable, try:
varstocases /make Sales from Sales.1 to Sales.4 /index=fiscalquarter (Sales).
Null
By default, SPSS will not create a row for missing values found on the /MAKE subcommand's FROM list. Add the /NULL=DROP subcommand to explicitly allow this behavior, or add the /NULL=KEEP subcommand to disable it.