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
* Find last 2 scores in Repeated Measure.
* In data below, want 4 6 for first case, 5 8 for second case, etc.
* rlevesque@videotron.ca.

* Sample data.
DATA LIST LIST /a1 TO a4.
BEGIN DATA
1 3  4 6
2 5 8 .
2 3 4 3
1 4 . .
5 . . .
END DATA.
LIST.

* Do the job.
VECTOR a=a1 TO a4.
LOOP #cnt=4 TO 1 BY -1.
DO IF ~MISSING(a(#cnt)).
IF #cnt>1 anl=a(#cnt-1).
COMPUTE al=a(#cnt).
BREAK.
END IF.
END LOOP.
EXECUTE.