1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
* Posted to SPSSX-L list on 2001/03/18.
* rlevesque@videotron.ca.

* What to restructure the data file. Run syntax to and look at data editor to
* see the objective.

DATA LIST LIST /resp purch eggs_1 meat_1 fish_1 apple_1 fruit_1.
BEGIN DATA
1	1	4	2	4	5	74
1	2	3	1	6	5	4
1	3	1	3	8	6	5
1	4	0	1	2	3	4
2	1	2	5	4	5	82		
2	2	2	5	1	2	4
3	1	3	2	1	4	5	
4	1	5	2	1	4	4	
5	1	2	2	2	2	0	
5	2	2	1	5	0	0	
END DATA.
LIST.

VECTOR eggs meat fish apple fruit(4F8.0).
DO REPEAT a=eggs meat fish apple fruit /b=eggs_1 meat_1 fish_1 apple_1 fruit_1.
COMPUTE a(purch)=b.
END REPEAT.
EXECUTE.

AGGREGATE
  /OUTFILE=*
  /BREAK=resp
  /eggs1 TO eggs4 = MAX(eggs1 TO eggs4) 
  /meat1 TO meat4 = MAX(meat1 TO meat4) 
  /fish1 TO fish4 = MAX(fish1 TO fish4) 
  /apple1 TO apple4 = MAX(apple1 TO apple4) 
  /fruit1 TO fruit4 = MAX(fruit1 TO fruit4).