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 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 16 Oct 2000 12:33:37 -0400
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: How to check if character data is all alpha?

On Mon, 16 Oct 2000 16:19:49 GMT, Brian Shore <bgs50@HOTMAIL.COM> wrote:

>Hi, > >Is there a way in SAS to determine if a character variable contains all >alphabetic data? For example, I read a var called ACCOUNT and I want to >know if the account number contains all alphabetic data. In some languages >(C, SQL?), there is a function called ISALPHA() that does this, but I don't >know of any such function in SAS. > >thanks >_________________________________________________________________________ >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > >Share information about yourself, create your own public profile at >http://profiles.msn.com.

In SAS you can use the verify function for that:

data test; a="skjdhkj 1"; rc=verify(upcase(a),"ABCDEFGHIJKLMNOPQRSTUVWXYZ "); put rc=; run;

This is much more flexible, because you can use your own definition, what is "alpha" (is $ alpha or not?). The second string contains all chars which you will allow. If you have a char in a which is not in the string, you will get the position of the unallowed char in a, or lets say "true". So you can use:

if not verify ...

verify returns "false" if the string only contains allowed chars.


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