SPSS TUTORIALS BASICS DATA ANALYSIS REGRESSION ANOVA T-TESTS

# Restructuring Data in SPSS – Overview

SPSS offers several simple ways for restructuring data. VARSTOCASES -short for “variables to cases”- stacks variables on top of each other.

Its reverse is CASESTOVARS -short for “cases to variables”. It basically stacks groups of cases behind each other in new variables.

AGGREGATE adds summary statistics such as frequencies, sums and means to your data, optionally collapsing cases in the process.

Finally, FLIP basically transposes data by rotating the entire dataset by 90 degrees.

## SPSS VARSTOCASES Tutorials

### SPSS VARSTOCASES – What and Why?

SPSS VARSTOCASES is short for “variables to cases”. It restructures data by stacking variables on top of each other. This tutorial also shows a major pitfall in SPSS VARSTOCASES.

### SPSS VARSTOCASES With Labels Tool

Simple, menu based tool for running SPSS VARSTOCASES while retaining variable labels of input variables. Comes in very handy for creating nice charts and tables.

## SPSS AGGREGATE Tutorials

### SPSS AGGREGATE Command

Aggregate is an SPSS command for creating variables holding statistics over cases. This tutorials briefly demonstrates the most common scenarios and points out some best practices.

### Disaggregate Data

Sometimes, one may start a project with aggregated data, weighted by a frequency variable. In some cases, though, disaggregating such data (creating n rows for a row with frequency n) may be desired.

# Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.

# THIS TUTORIAL HAS 2 COMMENTS:

• ### By Charles Klahm on April 23rd, 2021

Greetings,

I have data that were collected at the household-level with individuals nested within. I would like to restructure the data so that each household member represents a case, but I'd also like each household member to have the same household ID and family size information.

The original variable names in are main contact (name, last name, age, gender, covid vaccine), followed by additional family members (same info collected). Those variable labels will not work once restructured, so I'd like to have the variables named HHM (household member) name, last name, age, and so on.

I've played around with the restructure feature in SPSS and cannot get my desired outcome. I am not even sure it is possible because my skills are very limited. I am happy to send screenshots if my explanation is insufficient.

Any assistance/guidance will be greatly appreciated!

• ### By Ruben Geert van den Berg on April 24th, 2021

Hi Charles!

IMHO, the dialogs under Data - Restructure are unclear and misleading. They're only helpful for some operations in very simple scenarios.

What you seem to need is VARSTOCASES so look that up.

In real life (goes for me too) you may need several (failed) VARSTOCASES attempts before you get it right.

Such attempts don't need to take too much time if you do everything (including opening/closing your data and output) from syntax.

So start that off with something like

```*Close all data and output. dataset close all. new file. output close all.```

``` ```

```*Open data file. get file '(DATA FILE NAME GOES HERE)'.```

You should also carefully check your results with some checktables. For example,

-you could run DESCRIPTIVES on the original variables