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
* Rank on hte basis of 'good' cases.
* rlevesque@videotron.ca.

** This section creates data for illustration purposes.
DATA LIST FREE /person.
BEGIN DATA.
1 3 2 4 5 
END DATA.
SET SEED=135792468.
LOOP subj=1 TO 15.
	COMPUTE rating=TRUNC(UNIFORM(1)*3).
	XSAVE OUTFILE='data.sav' /KEEP person subj rating.
END LOOP.
EXECUTE.
GET  FILE='data.sav'.

** Start the job.
AGGREGATE
  /OUTFILE=*
  /BREAK=person rating
  /N_BREAK=N.
AGGREGATE
  /OUTFILE='temp.sav'
  /BREAK=person
  /nb=SUM(n_break).
SORT CASES BY person.
MATCH FILES /FILE=*
 /TABLE='temp.sav'
 /BY person.
* In next line replace the 2 by the value which means 'Good'.
SELECT IF (rating=2).
COMPUTE pcgood=n_break/nb.

RANK
  VARIABLES=pcgood  (A) /RANK /PRINT=YES
  /TIES=CONDENSE .