LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 13 Oct 1999 10:32:48 -0400
Reply-To:   Y.Huang@ORGANONINC.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ya Huang <Y.Huang@ORGANONINC.COM>
Subject:   Re: Filtering out a phone number
Comments:   To: kossack@NETCOM11.NETCOM.COM
Content-type:   multipart/alternative;

I would like to give it a try, see the code following:

DATA _NULL_; LENGTH A B $ 200; A='This string contains phone number like 973 123 4567, and a model number, like Pentium III/450'; b=a; put 'a= ' a; a=translate(a,'~','1','~','2','~','3','~','4','~','5','~','6','~','7','~','8 ','~','9','~','0'); put 'a= ' a; pos=index(a,'~~~ ~~~ ~~~~'); substr(a,pos,12)=''; put 'a= ' a; len=length(b); do i=1 to len; if substr(a,i,1) ne substr(b,i,1) and substr(a,i,1) ne ' ' then substr(a,i,1)=substr(b,i,1); end; put 'a= ' a; run;

----- log file ---

a= This string contains phone number like 973 123 4567, and a model number, like Pentium III/450 a= This string contains phone number like ~~~ ~~~ ~~~~, and a model number, like Pentium III/~~~ a= This string contains phone number like , and a model number, like Pentium III/~~~ a= This string contains phone number like , and a model number, like Pentium III/450

In case your string may already contains '~', you can replace it with something like 'FA'x.

Hope this helps

Ya Huang

-----Original Message----- From: Bill Kossack [mailto:kossack@NETCOM11.NETCOM.COM] Sent: Tuesday, October 12, 1999 5:10 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Filtering out a phone number

The rest of the string can contain numbers such as equipment model numbers that are of interest.

Richard Read Allen <rrallen@ibm.net> wrote:

: Is it possible for the useful consistent information to contain the digits : 0-9? If not, then use compress(x,'0123456789'). If it can contain digits, it's : a more difficult problem.

-- William S. Kossack Westminster, Colorado kossack@netcom.com


[text/html]


Back to: Top of message | Previous page | Main SAS-L page