Stack columns

Command: Tools
Next selectStack columns


Performs a multivariate to univariate conversion by stacking several spreadsheet columns into a new column.

The procedure creates 3 new columns for data, variables and cases.

For example:

Original data:

Stack columns example

Variables Hour12 and Hour24 stacked with variable Patient as variable with case identification:

Stack columns example

This function may be useful when you have to rearrange your data for procedures such as Serial measurements analysis, or Bland-Altman plot with multiple measurements per subject.

Required input

Stack columns example

  • Source: Variables to stack
    • Variables: select the variables of interest in the top left box and next click the right arrow button to move the selection to the Selected variables list.
    • Variable with case identification: a variable that will be replicated in one column for each stacked variable. If left blank, the row number will be used for case identification.
  • Target: Spreadsheet columns for new data and identifier variables.
    • Option List empty columns only: if this option is selected, only those columns that are empty will be listed in the following selection boxes.
    • Stacked case identification column: a new spreadsheet column that will be filled with a case identification, replicated for each stacked variable. (column Case in the example above)
    • Source variables identifier column: a spreadsheet column that will be filled with the variables names (column Hour in the example above)
    • Stacked data column: a spreadsheet column that will be filled with the stacked data (column Data in the example above)
    • Option Extract numbers from variable names: if the variable names contain numbers, like in the example Hour12 and Hour24, the numbers 12 and 24 will be extracted from the variables names and placed in the Source variables identifier column (see example below)
    • Option Clear columns: the selected columns will be cleared prior to storing the stacked data.

Click OK to proceed.

More examples

Example with the option "Extract numbers from variable names" selected:

Stack columns example

The numbers 12 and 24 are extracted from the variables names, making the variable Hour suitable for numerical analysis or inclusion in numerical procedures.

Example with the selection "Variable with case identification" left blank:

Stack columns example

The row number is used as case identifier.

See also

This site uses cookies to store information on your computer. More info...