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
*(Q) Can someone point me to syntax that will allow me to assign a new (known)
 id number (contained in a file with idnum and ss#) to a new file
 (with multiple and varying numbers of lines per case, all lines starting 
  with their ss#)?

*(A) Posted to SPSSX-L by Raynald Levesque on 2002/08/23.

* Demo data with SSN-ID pairs.
DATA LIST LIST /ssn newid.
BEGIN DATA
123456 100
222222 200
150150 300
END DATA.
LIST.

SORT CASES BY ssn.
SAVE OUTFILE='c:\\temp\\keys.sav'.

* Personal data, identified by SSN.
* We need to paste here IDs from keys file instead.
DATA LIST LIST /ssn var1.
BEGIN DATA
123456 27
222222 32
222222 49
222222 49
150150 57
150150 67
END DATA.
LIST.

* Matching.
SORT CASES BY ssn.
MATCH FILES FILE=* 
	/TABLE='c:\\temp\\keys.sav'
	/BY=ssn /DROP=ssn.

* Move the newid to the first column.
ADD FILES FILE=* /KEEP=newid ALL.