Unstacking/Stacking

Ribbon bar. Select the Data tab. In the Transformations group, click Stack to display the Unstacking/Stacking dialog box.

Classic menus. Select Unstacking/Stacking from the Data menu to display the Unstacking/Stacking dialog box.

This dialog box contains two tabs: Unstacking and Stacking. Details regarding the type of data restructuring that can be performed via these operations is described in the Data - Unstacking/Stacking topic.

Operating on large data files. Note that the stacking and unstacking operations can be performed much faster if the input file is already sorted by the data columns that will be used for the case (row, unit) IDs and variable (column, measurement) IDs.

Unstacking and stacking data files. In general, the purpose of these options is to perform "stacking" or "unstacking" of data files to make them suitable for statistical analysis; the general operation or restructuring of the data is similar to a cross-tabulation of values (given certain categorical variables), and this type of operation is also referred to as a cross-tabulation (restructuring) of the data (even though this specific operation is not limited to frequency data, nor is that application the one most commonly encountered). These operations are typically applied when accessing data from databases, where the individual data values are identified by case and variable IDs, and each unique combination of these IDs are contained in a new row of the data file.

For example, the following (stacked) example data file:

could be unstacked to the following form:

Multiple measurements (Measurement1 and Measurementk) could also be aggregated at each newly created variable (Mm, Mn, Nm, and Nn), for example, by computing means:

The stacking operation will essentially perform the reversed data restructuring operation.

SELECT CASES. Click this button to display the Spreadsheet Case Selection Conditions dialog box, which contains options to select only specified observations or cases for the stacking/unstacking operations.

OK. Click the OK button to begin the restructuring of the data to create a new unstacked data file.

Cancel. Click the Cancel button to close the dialog box.