Unstacking/Stacking - Stacking Tab

Select the Stacking tab of the Unstacking/Stacking dialog box to access options to reverse the unstacking operation, as described in the Unstacking/Stacking dialog box topic or the Data - Unstacking/Stacking topic. In many common cases, this operation can undo the unstacking operation. Exceptions include when multiple variables for column IDs or measurements (Column Variables or Value Variables) were selected during the unstack operation, or when multiple rows with the same key values existed and were aggregated in some way.  

For each case in the input and for each selected variable, this operation writes a new case to the resulting spreadsheet. This new case will have in the Destination Variable the value of the selected variable, and in the Code Variable it will have the name of the selected variable. All other unselected variables values are replicated. Thus, ignoring missing data, the stacked data set will have a number of cases equal to the number of cases in the input spreadsheet times the number of variables selected.

Variables. Click this button to display a standard variable selection dialog box. Select the variables for the Stacking operation. The values of the selected variables should contain the measurements. The names of the variables correspond to the values of the column variables in a stacked data source. Each variable selected here will result in a new case being added to the resulting stacked data set, with values from unselected variables being replicated in each case.

Destination variable name. The destination variable name is the name of the variable to create in the resulting stacked data set that will contain the measurements; i.e., the values of the selected variables get written to this variable.

Code variable name. This variable will have as values the names of the selected variables. These names correspond to the column IDs in the unstack operation.

Multiple series stack. Enter a number here  to have groups of stacked output rather than a single stacked variable. The series count denotes the number of variables present in each stacking series. Variables are ordered sequentially based on the selection from the variable selection dialog. If the series count cannot evenly divide into the total number of selected variables then the last stacking group will have fewer output variables and be padded with missing data.

Omit cases where selected variables contain missing data. When this check box is selected, and when a case for a selected variable contains missing data, no case will be written to the output. For multiple series stacking, each variable of the stack series must contain missing data for the case to be excluded.

Create code variable as text variable. The Coding Variable will contain the values taken from the names of the selected variables; therefore, this variable can be of type text or numeric with text labels. This option controls how to create the code variable.

Interleave output. Select the Interleave output check box to stack the cases as they are ordered in the original spreadsheet. Clear this check box to stack the output by the groups in the Code variable.

Include unstacked variables. Select the Include unstacked variables check box to include all of the other variables from the source spreadsheet into the output. Clear this check box to only include the stacked variable(s) and code variable in the output.

Use separate output variables for different input variable types. When this check box is selected, multiple variable types will be created in the output file, one per input variable type (double, integer, byte, text, or date.)

Create separate output variables of all types. This check box is available when the Use separate output variables for different input variable types check box is selected. The default behavior is to only create output variable types for the types of input variables encountered. When this check box is selected, all possible output variable types (double, text, integer, byte, and date) will be created in the output. Thus the number of variables and their order is predictable and consistent.

See also Stacking example.