1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
* How to remove a period from a string.
* Posted to SPSSX-L list by Raynald Levesque 2003/11/24.

DATA LIST LIST /a (A8).
BEGIN DATA
E801.2
V16.41
Z.1265
Z1.1265
END DATA.

* next code assumes period is not in first nor in last position of string.

STRING ecode_1(A8).
COMPUTE #idx=INDEX(a,'.').
COMPUTE ecode_1 = CONCAT(RTRIM(SUBSTR(a,1,#idx-1)),SUBSTR(a,#idx+1)).
EXECUTE.