How do I format data for input uto a repeated measures analysis of variance in SPSS?
Part of an example data set is given below representing measures of activity in different regions of the brain specified by eight combinations of areas corresponding to the x, y and z axes (called morph, anterior and lateral respectively) in 3 dimensions. The first four data points for subject 1 are given below. Each subject has replicates of the x, y, z combinations each of which are tried with differing numbers of electrodes. The activities across electrodes are not presumed to differ so we decide to pool them.
Morph 
Anterior 
Lateral 
Activity 

1 
1 
1 
0.75 

1 
1 
1 
0.03 

1 
1 
2 
0.85 

1 
1 
2 
0.61 
To present this as repeated measures data in SPSS we need to restructure the data as one row (per subject) with eight columns corresponding to each of the eight regional activity combinations meaned over the electrodes.
This can be done by first specifying a combination factor which represents all eight possible combinations of the x,y and z axes.
if (morph eq 1 and anterior eq 1 and lateral eq 1) comb=1. if (morph eq 2 and anterior eq 1 and lateral eq 1) comb=2. if (morph eq 1 and anterior eq 2 and lateral eq 1) comb=3. if (morph eq 1 and anterior eq 1 and lateral eq 2) comb=4. if (morph eq 2 and anterior eq 2 and lateral eq 1) comb=5. if (morph eq 2 and anterior eq 1 and lateral eq 2) comb=6. if (morph eq 1 and anterior eq 2 and lateral eq 2) comb=7. if (morph eq 2 and anterior eq 2 and lateral eq 2) comb=8. exe.
We can then use split file with a sort cases commands and the output management system (OMS) to produce a table of brain activity (in variable 'mmna') region combination means for each subject and send these to a SPSS data file. OMS identifies the table of subject by region activity means and reformats the table using the /COLUMNS subcommand before sending it to a file called comb.sav. The reformatted data is then ready for input into a repeated measures anova in SPSS.
SORT CASES BY subj . SPLIT FILE LAYERED BY subj . OMS /SELECT TABLES /IF SUBTYPES=['Report'] /DESTINATION FORMAT=SAV OUTFILE="C:\comb.SAV" /COLUMNS SEQUENCE=[C1 R2]. MEANS TABLES=mmna BY comb /CELLS MEAN COUNT STDDEV. OMSEND. GET FILE ='C:\comb.SAV'. SAVE OUTFILE='C:\comb2.SAV' /DROP=Command_ to Var2 N_1.00 to Std.Deviation_Total /RENAME=(Mean_1.00 to Mean_8.00=M111 M211 M121 M112 M221 M212 M122 M222). exe. GET FILE='C:\comb2.SAV'.
For the first two subjects this produces

Mean111 
Mean211 
Mean121 
Mean112 
Mean221 
Mean212 
Mean122 
Mean222 

Sub 1 
0.39 
0.23 
0.42 
0.73 
0.24 
0.25 
0.16 
0.36 

Sub 2 
1.22 
0.93 
0.52 
0.69 
0.04 
0.05 
0.06 
0.76 
The data can now be used in a repeated measures analysis.