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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
*(Q) I have data for 203 hospital centers and I want to compare each center with
the mean of the other 202 centers. I have 1 row of data for each center. My
data looks something like the following:

Id      var1    id2
3       1.5     1
5       2.3     0
18      1.4     0
.       .       .
.       .       .
.       .       .
203     2.5     0

I know I can manually program syntax to read something as follows:

Compute id2=0.
Do if id=3.
Compute id2=1.
End if.
Exe.
MEANS TABLES=var1 BY id2
        /CELLS MEAN COUNT STDDEV.
Compute id2=0.
Do if id=5.
Compute id2=1.
End if.


Etc..... for all 203 centers.

* (A) Posted to SPSSX-L list by Raynald Levesque on 2003/01/17.

DATA LIST LIST /id var1.
BEGIN DATA
3 1.5
7 2.2
11 3.1
14 2
17 2.3
18 1.9
21 2.2
END DATA.

*///////////.
DEFINE !doit(nb=!TOKENS(1))
COMPUTE casen=$CASENUM.
!DO !cnt=1 !TO !nb.
COMPUTE id2=0.
IF casen=!cnt id2=1.
MEANS TABLES=var1 BY id2
        /CELLS MEAN COUNT STDDEV.
!DOEND
!ENDDEFINE.
*///////////.

SET MPRINT=yes.
!doit nb=7.
SET MPRINT=no.

*(In your case, you would call the macro with nb=203).