1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
*(Q) I've been working on this one for a little while to no avail. Does anyone have 
	any advice for weeding out letters in a variable and creating  a 
	numeric variable with the remaining numbers? 
*(A) Posted to SPSSX-L by Raynald Levesque on 2002/08/23.

DATA LIST FIXED /str1 1-15(A).
BEGIN DATA
a76n6jgg4
j 8ujh7hh
12h12h12h
a0b1c2
c2b1c0
END DATA.
LIST.

COMPUTE #nb=0.
LOOP cnt=1 TO LENGTH(RTRIM(str1)).
COMPUTE #c=RANGE(SUBSTR(str1,cnt,1),'0','9').
IF #c=1 #nb=#nb*10+NUMBER(SUBSTR(str1,cnt,1),F1).
END LOOP.
COMPUTE nb=#nb.
EXE.