Check out newer version of this syntax (adapted for newer SPSS versions, tested with IBM SPSS Statistics 24).

 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
36
*(Q) How can I replace values of hrt which are above 480 
	by the average values of the remaining values.

*(A) Posted to spss newsgroup by Ray on 2002/04/17.
* http://spsstools.net.

* Sample data.
DATA LIST LIST /hrt clientid linenum.
BEGIN DATA
485     1002        1
280     1002        2
100     1002        3
420     1002        4
410     1002        5
510     1002        6
END DATA.
LIST.

SAVE OUTFILE='c:\temp\ori data.sav'.
SELECT IF hrt<=480.
COMPUTE nobreak=1.

AGGREGATE
  /OUTFILE='C:\temp\mean.sav'
  /BREAK=nobreak
  /meanhrt = MEAN(hrt).

GET FILE='c:\temp\ori data.sav'.
COMPUTE nobreak=1.
MATCH FILES /FILE=*
	/TABLE='C:\temp\mean.sav'
	/BY=nobreak.

IF hrt>480 hrt=meanhrt.
* Delete unneeded variables.
ADD FILES FILE=* /DROP=meanhrt nobreak.