Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working
Show menu

Stack columns

Command:Tools
Next selectStack columns

Description

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.

Example

When the original data are:

Stack columns example

After "Stacking", the resulting spreadsheet shows variables Hour12 and Hour24 stacked with variable Patient as variable with case identification:

Stack columns example

The Stack columns procedure 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 dialog box

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