This is a syntax example to call script calculating Levenshtein Distance. Script is here: Levenshtein Distance between 2 strings.

 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
DATA LIST LIST /s1 s2(2 A20).
BEGIN DATA
'Asdfghggfda'   'fasdfasdfasd'
'Agoirjvofid'       'Bsdfghggfda' 
'Dfuu9weroffg'   'Dfuu8weroffg' 
'Dfdagfsdfgd'     'dfsadf a f  afdas'
'Fdsafd asdfas'   'poihjuijioujoi'
'fadadf dafda'   'fBCadf dafda' 
'Adafdghfgdf a'  'foiugfyy7pouihiuh'
END DATA.

COMPUTE casenb=$CASENUM.
XSAVE OUTFILE='c:\\temp\\main data file.sav'.

* Define a macro containing the number of cases.

COMPUTE nobreak=1.
AGGREGATE OUTFILE=*
	/PRESORTED
	/BREAK=nobreak
	/N=n.
WRITE OUTFILE='c:\\temp\\nb cases.sps' /'DEFINE !nb()'n(F10.9)'!ENDDEFINE.'.
EXECUTE.
INCLUDE 'c:\\temp\\nb cases.sps'.


GET FILE='c:\\temp\\main data file.sav'.
RENAME VARIABLE (casenb=cases1).
* Create a file which includes all combination of s1 and s2.
LOOP #cnt=1 TO !nb.
- XSAVE OUTFILE='c:\\temp\\expands1.sav' /KEEP=s1 cases1.
END LOOP.
EXECUTE.

GET FILE='c:\\temp\\main data file.sav'.
LOOP cnt=1 TO !nb.
- XSAVE OUTFILE='c:\\temp\\expands2.sav' /KEEP=s2 casenb cnt.
END LOOP.
EXECUTE.

GET FILE='c:\\temp\\expands2.sav' .
SORT CASES BY cnt casenb.
MATCH FILES FILE=*
	/FILE='c:\\temp\\expands1.sav'
	/DROP=cnt.
SAVE OUTFILE='c:\\temp\\expanded file.sav'.

GET FILE='c:\\temp\\expanded file.sav' /KEEP=s1 s2 cases1 casenb.

STOP syntax HERE.

Run script.

Then run remaining portion of syntax.

55
56
57
58
59
60
61
62
63
DATA LIST FILE='c:\\temp\\distances.txt' LIST /d.
MATCH FILES FILE='c:\\temp\\expanded file.sav'
	/FILE=*.
SORT CASES BY s1 d.
AGGREGATE OUTFILE=*
	/PRESORTED
	/BREAK=s1
	/s2=FIRST(s2) /d=FIRST(d) /cases1=FIRST(cases1).
SORT CASES BY cases1.