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
* Create a new variable containing the mean of another variable.

* Ray 2003/06/17.

GET FILE='c:\\program files\\spss\\employee data.sav'.
SORT CASES BY educ.
COMPUTE nobreak=1.
AGGREGATE OUTFILE='c:\\temp\\temp.sav'
	/PRESORTED
	/BREAK=nobreak
	/avgeduc=MEAN(educ).

MATCH FILES FILE=*
	/TABLE='c:\\temp\\temp.sav'
	/BY=nobreak.

* want mean educ within each jobcat.
GET FILE='c:\\program files\\spss\\employee data.sav'.
SORT CASES BY jobcat.
AGGREGATE OUTFILE='c:\\temp\\temp.sav'
	/PRESORTED
	/BREAK=jobcat
	/avgeduc=MEAN(educ).

MATCH FILES FILE=*
	/TABLE='c:\\temp\\temp.sav'
	/BY=jobcat.