LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 4 Mar 2004 05:29:44 -0500
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: Validating Phone Numbers

Isn't that a bit simple? What about 0100-567891? Good or bad? And international numbers? (+41)-123-4567890

Do you really tell me, that only Numbers of the shape

0123456789

are good? If yes, use simply the verify and the length function for that. The length tells you, if there are 10 digits, verify gives you the position of any unwished digit. So

x=verify(phone,"0123456789")

will return 0 if there are no other digits in phone than in the compare-chars.

If you will allow also seperators for your pre-dial numbers, use compress-function to remove all chars you will allow for that and then test length and the contents.

On Wed, 3 Mar 2004 22:33:33 GMT, Karsten M. Self <kmself@IX.NETCOM.COM> wrote:

>On Wednesday 03 March 2004 10:24 am, 0101 htns wrote: > >> Hi SAS Lers, >> >> I need to validate phone numbers. What I want to do is to create a >> variable to flag good phone numbers and bad phone numbers. Good phone >> numbers are the ones that have 10 digits. Each digit is in the range >> of 0-9. Any help on how to approach this problem would be greatly >> appreciated. > >Please set your mailer/editor linewrap to 68-75 characters. I strongly >recommend 72 as a good default. > >While many mail clients will accomodate unwrapped text: > > - Some don't. Be considerate. > > - Many more fail to wrap and attribute quotes properly. > > - Many web-based list archives render unwrapped text as very long > lines, e.g.: > > http://lists.debian.org/debian-devel/2003/debian-devel-200309/msg00568.html > >Thank you. > > > >I'd recommend use of the 'compress()' and 'length()' functions. > >You might, alternatively, consider comparing the numbers to those on the >US national do-not-call registry. Numbers matching that list are valid, >and should not be called. > > >Peace. > >-- >Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/ > What Part of "Gestalt" don't you understand? > Erin Joyce: can't get the story right, won't correct it > http://z.iwethey.org/forums/render/content/show?contentid=96625


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