Date: Tue, 1 Oct 2002 06:00:00 GMT
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gregg Snell <gsnell@DATASAVANTCONSULTING.COM>
Subject: Re: Detecting letters in a character variable
Roland and Liz,
This solution will work for unsigned integers, but what about signed or real
numbers or even dollar signs?
Know thy data!
Gregg P. Snell
Data Savant Consulting
>Oh, I forgot. The length of a sas character variable is always at least one
>even if there is just a space. So try this instead
>if compress(animalid,'0123456789') NE ' ' then flag=1;
>"roland.rashleigh-berry" <email@example.com> wrote in
>> if length(compress(animalid,'0123456789'))>0 then flag=1;
>> else flag=0;
>> "Liz Hare" <eh51@CORNELL.EDU> wrote in message
>> > Hello,
>> > I want to detect whether an animal ID number has letters in it, and then
>> > set a flag for the ones that contain letters (as opposed to just
>> > The letters would appear in positions 6-8 so I was thinking of using
>> > to extract the sixth character. I'm not sure how to test whether it's
>> > letter, though.
>> > Thanks!
>> > Liz Hare