<?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: Verify Field is numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61874#M17557</link>
    <description>For some validations you may succeed by just using some simple validations functions ANYALPHA ANYDIGIT, ANYPUNCT, ANYSPACE, etc. &lt;BR /&gt;
&lt;BR /&gt;
In this case, it is definitely a task for regular expression matching:&lt;BR /&gt;
&lt;BR /&gt;
data OUT;&lt;BR /&gt;
set IN;&lt;BR /&gt;
EXPR='/^\d{5}([\-]\d{4})?$/'; * reg. expression match pattern for ZIP code;&lt;BR /&gt;
REGX=prxparse(strip(EXPR)); * parse the expression;&lt;BR /&gt;
OK=prxmatch(REGX,ZIP); * try the match for ZIP;&lt;BR /&gt;
put ZIP= OK=; * print result;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
More info here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002288677.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002288677.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002291852.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002291852.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002296115.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002296115.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Also check the following tutorial:&lt;BR /&gt;
&lt;A href="http://www.regular-expressions.info/tutorial.html" target="_blank"&gt;http://www.regular-expressions.info/tutorial.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
    <pubDate>Thu, 06 Aug 2009 07:40:19 GMT</pubDate>
    <dc:creator>DanielSantos</dc:creator>
    <dc:date>2009-08-06T07:40:19Z</dc:date>
    <item>
      <title>Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61870#M17553</link>
      <description>I have a zip field that is defined as character.  I need to make it numeric to append it to another table.  My problem is that there is a row with "?????" as the zip code.  Can anyone suggest a good way to do this check and check to see if it's blank at the same time?  &lt;BR /&gt;
&lt;BR /&gt;
Thank you so much for any help&lt;BR /&gt;
&lt;BR /&gt;
Jerry</description>
      <pubDate>Wed, 05 Aug 2009 18:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61870#M17553</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-08-05T18:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61871#M17554</link>
      <description>You could do something like:&lt;BR /&gt;
if zip ne put(input(zip, best.), z5.) then *FLAG ERROR*</description>
      <pubDate>Wed, 05 Aug 2009 18:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61871#M17554</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-08-05T18:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61872#M17555</link>
      <description>Flip,&lt;BR /&gt;
Thank you so much that helped.&lt;BR /&gt;
&lt;BR /&gt;
Jerry</description>
      <pubDate>Wed, 05 Aug 2009 18:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61872#M17555</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-08-05T18:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61873#M17556</link>
      <description>Unfortunately, ZIP_CODE could include zip+4 (character data, length up to 10), if the field length is greater than 5 (and any input validation allows it).  And, so, it would be a gamble if/when you attempt to use PROC IMPORT and the first "GUESSINGROWS" values are all five-digit and then comes a zip+4 which would be invalid and the result would be a SAS MISSING value.  As well, consider inclusion of other mail/postal codes which may occur any in an input file -- alpha-numeric strings, imbedded blanks likely.&lt;BR /&gt;
&lt;BR /&gt;
Interesting challenge to consider when using smart tools/wizards for a manually-defined DATA step substitution.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 05 Aug 2009 19:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61873#M17556</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-05T19:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61874#M17557</link>
      <description>For some validations you may succeed by just using some simple validations functions ANYALPHA ANYDIGIT, ANYPUNCT, ANYSPACE, etc. &lt;BR /&gt;
&lt;BR /&gt;
In this case, it is definitely a task for regular expression matching:&lt;BR /&gt;
&lt;BR /&gt;
data OUT;&lt;BR /&gt;
set IN;&lt;BR /&gt;
EXPR='/^\d{5}([\-]\d{4})?$/'; * reg. expression match pattern for ZIP code;&lt;BR /&gt;
REGX=prxparse(strip(EXPR)); * parse the expression;&lt;BR /&gt;
OK=prxmatch(REGX,ZIP); * try the match for ZIP;&lt;BR /&gt;
put ZIP= OK=; * print result;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
More info here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002288677.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002288677.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002291852.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002291852.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002296115.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002296115.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Also check the following tutorial:&lt;BR /&gt;
&lt;A href="http://www.regular-expressions.info/tutorial.html" target="_blank"&gt;http://www.regular-expressions.info/tutorial.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Thu, 06 Aug 2009 07:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61874#M17557</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-08-06T07:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Verify Field is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61875#M17558</link>
      <description>Daniel &amp;amp; Scott,&lt;BR /&gt;
Thank you to both of you for your suggestions. &lt;BR /&gt;
&lt;BR /&gt;
Scott I know for this zip field it is only 5 characters long or less.  I have a separate column for the plus4 part of a zip code.&lt;BR /&gt;
&lt;BR /&gt;
I used Flip's suggestion and got it to work but will have to revisit this situation more then likely in a day or so and find out why the source even has non numeric characters.&lt;BR /&gt;
&lt;BR /&gt;
Thanks to everyone for all your help&lt;BR /&gt;
&lt;BR /&gt;
Jerry</description>
      <pubDate>Thu, 06 Aug 2009 13:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Verify-Field-is-numeric/m-p/61875#M17558</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2009-08-06T13:11:05Z</dc:date>
    </item>
  </channel>
</rss>

