1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
* (Q) I would like to exclude "outliers" from my analysis where I define
	outliers as values outside mean +/- 2 times the sd.

* (A) posted by Ray 2001/10/15.

GET FILE='c:\\program files\\spss\\employee data.sav'.

* next command create a new variable named zsal which contains the z-scores of salary.
DESCRIPTIVE salary(zsal) /STATISTICS=MEAN STDDEV MIN MAX.

* Exclude outliers (cases with z-scores outside the (-2,2) range).
SELECT IF RANGE(zsal,-2,2).

DESCRIPTIVE salary zsal /STATISTICS=MIN MAX.
EXECUTE.

   .