<?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: Invalid numeric data error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327378#M73022</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;SAS is converting your character variable's value to a number because you used a character expression as the condition to be evaluated. &amp;nbsp;In this statement you are using the MAX operator, so&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO &amp;lt;&amp;gt; ' ' THEN OUTPUT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is the same as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF max(V_PRO,' ') THEN OUTPUT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since the value of V_PRO was greater than a space SAS tried to convert it to a number so it could test if it true, that is not zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you meant to test if variable was not all blanks? &amp;nbsp;There are many ways to do that but using the MAX() operator is not one of them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO ne ' ' THEN OUTPUT;
IF V_PRO ^= ' ' THEN OUTPUT;
IF not (V_PRO = ' ') THEN OUTPUT;
IF not missing(V_PRO) THEN OUTPUT:
IF V_PRO = ' ' THEN ; ELSE OUTPUT;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would not say that MAX operator is the same as MAX function as the function requires numeric arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;25         data _null_;
26            x = 'A' &amp;lt;&amp;gt; 'B';
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".
27            y = max('A','B');
28            put _all_;
29            run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      27:12   27:16   
NOTE: Invalid numeric data, 'A' , at line 27 column 12.
NOTE: Invalid numeric data, 'B' , at line 27 column 16.
x=B y=. _ERROR_=1 _N_=1
x=B y=. _ERROR_=1 _N_=1&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Jan 2017 13:51:06 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2017-01-25T13:51:06Z</dc:date>
    <item>
      <title>Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327127#M72952</link>
      <description>&lt;P&gt;I am getting the error message:&amp;nbsp;NOTE: Invalid numeric data, 'EFT/150405' , at line 13 column 15.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the SAS code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INFILE FILEIN FIRSTOBS=3; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INPUT @3 V_PRO $CHAR10. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;12 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @14 V_SUF $CHAR02.; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF V_PRO &amp;lt;&amp;gt; ' ' &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;14 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; THEN OUTPUT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why would I get an error for invalid numeric data when the variable is defined as $CHAR10.?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 18:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327127#M72952</guid>
      <dc:creator>mwhsas</dc:creator>
      <dc:date>2017-01-24T18:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327131#M72954</link>
      <description>&lt;P&gt;YOu have just revealed a property of the &amp;lt;&amp;gt; operator vs. the ^= operator.&amp;nbsp;&amp;nbsp; The earlier apparently only works for numeric data.&amp;nbsp; Change you condition to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; IF V_PRO ^= ' ';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 18:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327131#M72954</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-01-24T18:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327138#M72955</link>
      <description>&lt;P&gt;YOu might also want to consider the advantages of using the Missing function. It doesn't care what type the variable is so you can use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If missing(var) then .... ;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;If not missing(var) then ....;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 18:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327138#M72955</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-24T18:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327189#M72967</link>
      <description>&lt;P&gt;Just to be more explicit: &amp;lt;&amp;gt; returns the maximum value of two variables (&amp;gt;&amp;lt; is the minimum). It's a long-standing SAS operator: it still works like this in data steps, but is problematic.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 21:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327189#M72967</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-01-24T21:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327195#M72968</link>
      <description>&lt;P&gt;thanks for the needed clarification.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 21:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327195#M72968</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-01-24T21:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327362#M73017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/125192"&gt;@mwhsas&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am getting the error message:&amp;nbsp;NOTE: Invalid numeric data, 'EFT/150405' , at line 13 column 15.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the SAS code:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INFILE FILEIN FIRSTOBS=3; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INPUT @3 V_PRO $CHAR10. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/70859"&gt;@12&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/189370"&gt;@14&lt;/a&gt; V_SUF $CHAR02.; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF V_PRO &amp;lt;&amp;gt; ' ' &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;14 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; THEN OUTPUT;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would I get an error for invalid numeric data when the variable is defined as $CHAR10.?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You also get a note that tells you that &amp;lt;&amp;gt; is not the NOT operator.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 12:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327362#M73017</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-01-25T12:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327374#M73020</link>
      <description>&lt;P&gt;SAS is converting your character variable's value to a number because you used a character expression as the condition to be evaluated. &amp;nbsp;In this statement you are using the MAX operator, so&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO &amp;lt;&amp;gt; ' ' THEN OUTPUT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is the same as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF max(V_PRO,' ') THEN OUTPUT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Correction:&lt;/STRONG&gt; That is if the MAX() function worked on character strings the same way that the &amp;lt;&amp;gt; (max) operator does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the value of V_PRO was greater than a space SAS tried to convert it to a number so it could test if it true, that is not zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you meant to test if variable was not all blanks? &amp;nbsp;There are many ways to do that but using the MAX() operator is not one of them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO ne ' ' THEN OUTPUT;
IF V_PRO ^= ' ' THEN OUTPUT;
IF not (V_PRO = ' ') THEN OUTPUT;
IF not missing(V_PRO) THEN OUTPUT:
IF V_PRO = ' ' THEN ; ELSE OUTPUT;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 14:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327374#M73020</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-25T14:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327378#M73022</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;SAS is converting your character variable's value to a number because you used a character expression as the condition to be evaluated. &amp;nbsp;In this statement you are using the MAX operator, so&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO &amp;lt;&amp;gt; ' ' THEN OUTPUT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is the same as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF max(V_PRO,' ') THEN OUTPUT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since the value of V_PRO was greater than a space SAS tried to convert it to a number so it could test if it true, that is not zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you meant to test if variable was not all blanks? &amp;nbsp;There are many ways to do that but using the MAX() operator is not one of them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF V_PRO ne ' ' THEN OUTPUT;
IF V_PRO ^= ' ' THEN OUTPUT;
IF not (V_PRO = ' ') THEN OUTPUT;
IF not missing(V_PRO) THEN OUTPUT:
IF V_PRO = ' ' THEN ; ELSE OUTPUT;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would not say that MAX operator is the same as MAX function as the function requires numeric arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;25         data _null_;
26            x = 'A' &amp;lt;&amp;gt; 'B';
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".
27            y = max('A','B');
28            put _all_;
29            run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      27:12   27:16   
NOTE: Invalid numeric data, 'A' , at line 27 column 12.
NOTE: Invalid numeric data, 'B' , at line 27 column 16.
x=B y=. _ERROR_=1 _N_=1
x=B y=. _ERROR_=1 _N_=1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jan 2017 13:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327378#M73022</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-01-25T13:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327381#M73023</link>
      <description>&lt;P&gt;Good to know if you did want to take the max of two character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the &amp;lt;&amp;gt; operator is overloaded and can be used for both numeric and character operands, but the MAX() function is not. &amp;nbsp;So the MAX() function is more like the INPUTN() function than the INPUT() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 14:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327381#M73023</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-25T14:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327386#M73024</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Good to know if you did want to take the max of two character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the &amp;lt;&amp;gt; operator is overloaded and can be used for both numeric and character operands, but the MAX() function is not. &amp;nbsp;So the MAX() function is more like the INPUTN() function than the INPUT() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes I think overloaded describes it.&amp;nbsp; I wonder if overloading was a computer science term when Tony Barr wrote the code for the MIN an MAX&amp;nbsp;operators.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 14:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327386#M73024</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-01-25T14:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327407#M73032</link>
      <description>&lt;P&gt;This is all great information. I thank you all very much. Obviously, I am not an experienced SAS programmer. For my program, I simply changed &amp;lt;&amp;gt; to NE and got the desired results. I was just checking for blanks in the input field.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 15:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/327407#M73032</guid>
      <dc:creator>mwhsas</dc:creator>
      <dc:date>2017-01-25T15:27:31Z</dc:date>
    </item>
  </channel>
</rss>

