deleting text from combined text/numeric cells

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

deleting text from combined text/numeric cells

Scott Collier
I have a column of Case ID's that were assigned using a combination of
letters(6) and numbers(121174). The cells look like this HUDBET121174 The
numbers represent birthdates and I want to separate these from the letters
which are useless to me.  I just want the cell HUDBET121174 to be
displayed as 121174  I looked in the archives and found some similar
topics but was unable to find an exactly similar situation.  Thanks in
advance.
Scott
Reply | Threaded
Open this post in threaded view
|

Re: deleting text from combined text/numeric cells

Richard Ristow
At 07:27 PM 6/7/2007, Scott Collier wrote:

>I have a column of Case ID's that were assigned using a combination of
>letters(6) and numbers(121174). The cells look like this HUDBET121174.
>[...] I just want the cell HUDBET121174 to be displayed as 121174.

Not tested, but something like these:

A. If it's really always 6 letters, then 6 digits:

STRING  BDstring (A6).
COMPUTE BDstring = SUBSTR(CaseID,7).


B. If the number of letters before the digits can vary. (I'm allowing
for at most 8 digits):

STRING  BDstring (A8).
COMPUTE #FrstDig = INDEX(CaseID,'0123456789',1).
COMPUTE BDstring = SUBSTR(CaseID,#FrstDig).

Since you're extracting a birthdate, you may want to make it an SPSS
date variable rather than a string, but that's another story.