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
* Get mean from 3 different files.
* You must replace path and file names.
* Ray.

DEFINE !GETIT ().
GET FILE "c:\\Program Files\\SPSS\\test\\file1997.sav".
COMPUTE year=1997.
SAVE OUTFILE='C:\\Program Files\\SPSS\\test\\temp.sav'.

!DO !var=1998 !TO 1999.
GET FILE !QUOTE(!CONCAT("c:\\Program Files\\SPSS\\test\\file",!var,".sav")).
COMPUTE year=!var.
ADD FILES /FILE=*
 /FILE='C:\\Program Files\\SPSS\\test\\temp.sav'.
SAVE OUTFILE='C:\\Program Files\\SPSS\\test\\temp.sav'.
!DOEND.

AGGREGATE
  /OUTFILE=*
  /BREAK=year
  /v_1 = MEAN(v).
!ENDDEFINE.


!GETIT.
LIST.