Legend:

Menu Selections

Variable Names

Radio Options

Menu Box Names

Download mixedL.sav 

(see “SPSS format” under “Files used in the examples”)

Open mixedL.sav:

mixedL.sav preview

Transform using Restructure

In the SPSS menu, select Data  Restructure

SPSS screenshot

Select Restructure selected cases into variables.

SPSS screenshot

  • Select First and Last variables and drag to Identifier Variable(s).
  • Select Group variable and drag to Index Variables(s).

Notes:

  • Because there is no explicit identification variable in the data, we use First and Last variables to identify observations.

SPSS screenshot

Select Yes.

SPSS screenshot

Select Group by original variable.

SPSS screenshot

  • Select Restructure the data now.
  • Select Finish.

Optional Sort

Select Data → Sort Cases

SPSS screenshot

  • Drag Last to Sort by box (and select Descending under Sort Order) and drag First to Sort by box (and select Ascending).

SPSS screenshot

Transform using Restructure

In the SPSS menu, select Data  Restructure

SPSS screenshot

Select Restructure selected variables into cases.

SPSS screenshot

Select More than one.

Type 3 For How Many?

(In this example, three variable groups are created (A, B, C))

SPSS screenshot

  • Set Use Case Number to None (see Note below).
  • Name the first Target Variable under Variables to be Transposed (A).
  • Select “A” variables (Veggie.A and Fruit.A) on the left and drag them to box beneath Target Variable.
  • Repeat previous two steps separately for “B” and “C” variables.

Notes:

  • It is possible to create a case ID variable by selecting Use Case Number under Case Group Identification. This may be helpful in some datasets for identifying and sorting data.

  • The remaining variable(s) (e.g. Age) are either specified explicitly in this step (as Fixed Variables(s)), or carried forward in Step 6 of the Wizard.

SPSS screenshot

Select One.

(Veggie and Fruit have one index - Type.)

SPSS screenshot

  • Change Name (Index1) to Type and Levels to 2.
    Note: there are two levels: Veggie and Fruit

SPSS screenshot

  • Select Keep and treat as fixed variable(s).
  • Select Create a case in the new file.

SPSS screenshot

  • Select Restructure the data now.
  • Select Finish.

Optional Sort

Select Data → Sort Cases

SPSS screenshot

  • Drag Type, Last (select Descending under Sort Order) and First (select Ascending) to Sort by box.

Optional Value Labels

SPSS screenshot

  • In Variable View, change the Value Labels the Type variable.
  • In Data View select  SPSS screenshot icon.

reshaped data

--- The End ---