1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
* Flag first and last dates (within each ID).
* Ray.
DATA LIST FIXED /id 1-1 (F) date1 3-12(ADATE)  date2 14-23(ADATE).
BEGIN DATA.
1 01-01-2000 01-04-2000
1 10-04-2001 11-01-2001
1 05-05-2000 05-25-2001
2 02-07-2000 12-06-2000
2 03-05-2000 03-15-2000
2 02-28-2000 02-28-2000
END DATA.

FORMATS date1 date2 (ADATE12).
* Say we want the first (oldest) date of date1.
SORT CASES BY id date1.
MATCH FILES FILE=* /BY=id /FIRST=first.

* Say we want the last (most recent) date of date2.
SORT CASES BY id date2.
MATCH FILES FILE=* /BY=id /LAST=last.
EXECUTE.