<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to check if first character is numeric? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75343#M21848</link>
    <description>Thank you for replying data _null_.&lt;BR /&gt;
I was just about to post my solution which consists of the VERIFY function.&lt;BR /&gt;
&lt;BR /&gt;
char1=substr(addr1,1,1);		&lt;BR /&gt;
&lt;BR /&gt;
if verify(trim(left(char1)),'0123456789')=0 Then&lt;BR /&gt;
a='numeric';&lt;BR /&gt;
else &lt;BR /&gt;
a ='char';&lt;BR /&gt;
&lt;BR /&gt;
Thank You&lt;BR /&gt;
Jerry</description>
    <pubDate>Tue, 24 Feb 2009 18:46:21 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-02-24T18:46:21Z</dc:date>
    <item>
      <title>How to check if first character is numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75341#M21846</link>
      <description>I'm using this statement to get back the first character in an address field.&lt;BR /&gt;
I'm having a problem finding a way to verify what it is. &lt;BR /&gt;
char1=substr(addr,1,1);	&lt;BR /&gt;
&lt;BR /&gt;
I tried this :&lt;BR /&gt;
&lt;BR /&gt;
if (input(addr,  1.) eq .) then&lt;BR /&gt;
   a='non-numeric';&lt;BR /&gt;
else &lt;BR /&gt;
   a ='numeric';&lt;BR /&gt;
&lt;BR /&gt;
When I try this I get a lot of &lt;BR /&gt;
"NOTE: Invalid argument to function INPUT at line 1063 column 9." How can I get it to have a clean execution?&lt;BR /&gt;
&lt;BR /&gt;
Thank You</description>
      <pubDate>Tue, 24 Feb 2009 18:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75341#M21846</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-24T18:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if first character is numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75342#M21847</link>
      <description>Use ?? in format field of INPUT function.  You may want to look a VERIFY function also.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; I'm using this statement to get back the first&lt;BR /&gt;
&amp;gt; character in an address field.&lt;BR /&gt;
&amp;gt; I'm having a problem finding a way to verify what it&lt;BR /&gt;
&amp;gt; is. &lt;BR /&gt;
&amp;gt; char1=substr(addr,1,1);	&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I tried this :&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; if (input(addr,  ??1.) eq .) then&lt;BR /&gt;
&amp;gt;    a='non-numeric';&lt;BR /&gt;
&amp;gt; e &lt;BR /&gt;
&amp;gt;    a ='numeric';&lt;BR /&gt;
&amp;gt; hen I try this I get a lot of &lt;BR /&gt;
&amp;gt; "NOTE: Invalid argument to function INPUT at line&lt;BR /&gt;
&amp;gt; 1063 column 9." How can I get it to have a clean&lt;BR /&gt;
&amp;gt; execution?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thank You</description>
      <pubDate>Tue, 24 Feb 2009 18:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75342#M21847</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-02-24T18:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if first character is numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75343#M21848</link>
      <description>Thank you for replying data _null_.&lt;BR /&gt;
I was just about to post my solution which consists of the VERIFY function.&lt;BR /&gt;
&lt;BR /&gt;
char1=substr(addr1,1,1);		&lt;BR /&gt;
&lt;BR /&gt;
if verify(trim(left(char1)),'0123456789')=0 Then&lt;BR /&gt;
a='numeric';&lt;BR /&gt;
else &lt;BR /&gt;
a ='char';&lt;BR /&gt;
&lt;BR /&gt;
Thank You&lt;BR /&gt;
Jerry</description>
      <pubDate>Tue, 24 Feb 2009 18:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75343#M21848</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-24T18:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if first character is numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75344#M21849</link>
      <description>ANYDIGIT function would probably be faster.  If you are just looking at the first position.  The technique you are using is better for test if a string is a number, so strings like 1e4 would be read correctly.  If your numbers could include commas or dollar sign use COMMA informat.&lt;BR /&gt;
&lt;BR /&gt;
If you are trying to see if string is a SAS name NVALID function.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   input string $16.;&lt;BR /&gt;
   x = anydigit(string);&lt;BR /&gt;
   if anydigit(string) eq 1 then put 'Digit in First Position' string=;&lt;BR /&gt;
   put (_all_)(=);&lt;BR /&gt;
   cards;&lt;BR /&gt;
1e000&lt;BR /&gt;
e1000&lt;BR /&gt;
.This&lt;BR /&gt;
This&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 24 Feb 2009 18:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75344#M21849</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-02-24T18:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if first character is numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75345#M21850</link>
      <description>Data,&lt;BR /&gt;
What i'm trying to do is check if the first character in my address field is truley a number or is it a character.  We are trying to clean the data up and i'm trying to find all the address that start with a letter since mostly all address start with a number.&lt;BR /&gt;
&lt;BR /&gt;
For what i'm trying to do is mine way correct?  With anydigit would I have to check every digit ex. 1,2,3,4,5 etc..?</description>
      <pubDate>Tue, 24 Feb 2009 18:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-check-if-first-character-is-numeric/m-p/75345#M21850</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-24T18:57:26Z</dc:date>
    </item>
  </channel>
</rss>

