<?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: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501595#M133755</link>
    <description>&lt;P&gt;I am going to guess that the non "NI" values of ENR_END_DATE actually look more like the MMDDYY10. from ENR_START_DATE.&lt;/P&gt;
&lt;P&gt;In which case you would want to 1) use the mmddyy10 informat, 2) instead of '0' assign . for missing 3) assign an appropriate format such as mmddyy10. for the new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or go back to the import step, copy the data step code created by proc import (assumed) from the log, paste into the editor&amp;nbsp;and change the informat and format to mmyydd10. perhaps add ?? after the variable name in the input statement to suppress invalid date messages for that variable reading the data.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 17:08:51 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-10-04T17:08:51Z</dc:date>
    <item>
      <title>Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501585#M133751</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw there are a few post about input statement errors but so far I haven't find one that solves my problem, so I am posting it here. I am doing a very basic character to numeric convert for a variable that supposed to be date value. My input data was import from CSV file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc contents on my dataset after import as below. the variable I want to convert is&lt;/P&gt;&lt;P&gt;Alphabetic List of Variables and Attributes# Variable Type Len Format Informat35421&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ENR_CODE&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;BEST12.&lt;/TD&gt;&lt;TD&gt;BEST32.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#ff0000"&gt;ENR_END_DATE&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#ff0000"&gt;Char&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#ff0000"&gt;10&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#ff0000"&gt;$10.&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#ff0000"&gt;$10.&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ENR_START_DATE&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;MMDDYY10.&lt;/TD&gt;&lt;TD&gt;MMDDYY10.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAYER_PLAN_ID&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;$7.&lt;/TD&gt;&lt;TD&gt;$7.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PERSON_ID&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;BEST12.&lt;/TD&gt;&lt;TD&gt;BEST32.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The missing values in this variables are entered as 'NI', so&amp;nbsp;my first intuition is that this&amp;nbsp;true character sting is preventing the conversion, so&amp;nbsp;changed&amp;nbsp;'NI' to 0 then I did a simple input statement on this variable:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; pnt.oha_enro;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ENR_END_DATE = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'NI'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ENR_end_date = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT face="Courier New" size="2"&gt;try = input(ENR_END_DATE,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;8.0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Then I got this in the log window&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;try = input(ENR_END_DATE,8.0);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;NOTE: Invalid argument to function INPUT at line 90 column 7.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone has an idea why it's happening?&lt;/P&gt;&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 16:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501585#M133751</guid>
      <dc:creator>LisaYIN9309</dc:creator>
      <dc:date>2018-10-04T16:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501588#M133752</link>
      <description>&lt;P&gt;What does that variable look like? And do you have missing values? Missing would generate that error as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172549"&gt;@LisaYIN9309&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I saw there are a few post about input statement errors but so far I haven't find one that solves my problem, so I am posting it here. I am doing a very basic character to numeric convert for a variable that supposed to be date value. My input data was import from CSV file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc contents on my dataset after import as below. the variable I want to convert is&lt;/P&gt;
&lt;P&gt;Alphabetic List of Variables and Attributes# Variable Type Len Format Informat35421&lt;/P&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;ENR_CODE&lt;/TD&gt;
&lt;TD&gt;Num&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;BEST12.&lt;/TD&gt;
&lt;TD&gt;BEST32.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT color="#ff0000"&gt;ENR_END_DATE&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#ff0000"&gt;Char&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#ff0000"&gt;10&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#ff0000"&gt;$10.&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#ff0000"&gt;$10.&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ENR_START_DATE&lt;/TD&gt;
&lt;TD&gt;Num&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;MMDDYY10.&lt;/TD&gt;
&lt;TD&gt;MMDDYY10.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PAYER_PLAN_ID&lt;/TD&gt;
&lt;TD&gt;Char&lt;/TD&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;$7.&lt;/TD&gt;
&lt;TD&gt;$7.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PERSON_ID&lt;/TD&gt;
&lt;TD&gt;Num&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;BEST12.&lt;/TD&gt;
&lt;TD&gt;BEST32.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing values in this variables are entered as 'NI', so&amp;nbsp;my first intuition is that this&amp;nbsp;true character sting is preventing the conversion, so&amp;nbsp;changed&amp;nbsp;'NI' to 0 then I did a simple input statement on this variable:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; pnt.oha_enro;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ENR_END_DATE = &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'NI'&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ENR_end_date = &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT face="Courier New" size="2"&gt;try = input(ENR_END_DATE,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;8.0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Then I got this in the log window&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;data test2;&lt;/P&gt;
&lt;P&gt;set test;&lt;/P&gt;
&lt;P&gt;try = input(ENR_END_DATE,8.0);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;NOTE: Invalid argument to function INPUT at line 90 column 7.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone has an idea why it's happening?&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 16:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501588#M133752</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-04T16:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501595#M133755</link>
      <description>&lt;P&gt;I am going to guess that the non "NI" values of ENR_END_DATE actually look more like the MMDDYY10. from ENR_START_DATE.&lt;/P&gt;
&lt;P&gt;In which case you would want to 1) use the mmddyy10 informat, 2) instead of '0' assign . for missing 3) assign an appropriate format such as mmddyy10. for the new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or go back to the import step, copy the data step code created by proc import (assumed) from the log, paste into the editor&amp;nbsp;and change the informat and format to mmyydd10. perhaps add ?? after the variable name in the input statement to suppress invalid date messages for that variable reading the data.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501595#M133755</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-04T17:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501599#M133759</link>
      <description>&lt;P&gt;A 10-character variable with "date" in the name lets me think it will contain values like 09/04/2018, which can't be input with an 8. informat. If the values are like that, use a proper date informat.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501599#M133759</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-04T17:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501633#M133778</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, I changed the 'NI' to a mmddyy10. format value instead of 0 and it worked! seems like 0 is the problem. There is no other missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501633#M133778</guid>
      <dc:creator>LisaYIN9309</dc:creator>
      <dc:date>2018-10-04T18:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric: Error: NOTE: Invalid argument to function INPUT at line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501756#M133827</link>
      <description>&lt;P&gt;The most elegant method to do this is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;try = ifn(enr_end_date = 'NI',.,input(enr_end_date,mmddyy10.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Oct 2018 06:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric-Error-NOTE-Invalid-argument-to-function/m-p/501756#M133827</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-05T06:38:39Z</dc:date>
    </item>
  </channel>
</rss>

