1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*(Q) A file has cases with the same ID. How can I save a copy of duplicates in a separate file.

*(A) Posted to SPSSX-L list by Raynald Levesque on 20002/09/14.


DATA LIST LIST /Casenb ID.
BEGIN DATA
1    1
2    2
3    2
4    3
5    4
6    5
7    5
END DATA.
LIST.

SAVE OUTFILE='c"\\temp\\original data.sav'.
SORT CASES BY ID.
MATCH FILES FILE=* /BY=id /FIRST=first /LAST=last.
SELECT IF SUM(first,last)<2.
SAVE OUTFILE='c:\\temp\\duplicates.sav' /DROP=first last.

*Casenb 2,3,6 and 7 are in the duplicates.sav file.