<?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: NOTE: Invalid argument to function INPUT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430061#M106280</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113602"&gt;@timeless&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;For some reason ?? gives me an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Expecting a format name.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You still need to give it a format. Just add the ?? before the format specification.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(xxx,??6.)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Jan 2018 16:12:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-01-23T16:12:56Z</dc:date>
    <item>
      <title>NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255926#M48954</link>
      <description>&lt;P&gt;I'm using an array to convert character variables to numeric. The code executes w/o errors or warnings, but the notes state "&amp;nbsp;NOTE: Invalid argument to function INPUT at line 80 column 16."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's wrong w/ this syntax? Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;79 DO i=1 to dim(_char);&lt;/P&gt;
&lt;P&gt;80 _num(i) = input(_char(i),6.);&lt;BR /&gt; 81 END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA conversion_subset;
	SET	dropping_strings;

 	Array _char(*) $ 
 	_100400
	_100500
 	_100600
 	_200100
 	_200200
	_200300
	_200400
	_200401
	_400402
	_400403
	_400601
	_400602
	
	_500800
	_500900
	_501000;
	
 	Array _num(*) var1-var15;
  	
  	DO i=1 to dim(_char);
     _num(i) = input(_char(i),6.); 
    END;
     
    DROP 
	_100400
	_100500
 	_100600
 	_200100
 	_200200
	_200300
	_200400
	_200401
	_400402
	_400403
	_400601
	_400602	
	_500800
	_500900
	_501000
	i; 
	
	RENAME
	VAR1	=	_100400
	VAR2	=	_100500
	VAR3	=	_100600
	VAR4	=	_200100
	VAR5	=	_200200
	VAR6	=	_200300
	VAR7	=	_200400
	VAR8	=	_200401
	VAR9	=	_400402
	VAR10	=	_400403
	VAR11	= 	_400601
	VAR12	=	_400602
	VAR13	=	_500800
	VAR14	=	_500900
	VAR15	=	_501000;
RUN;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 20:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255926#M48954</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-10T20:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255940#M48964</link>
      <description>&lt;P&gt;The syntax is fine.&amp;nbsp; There may be something wrong with the data.&amp;nbsp; This is saying that one (or more) of the incoming character variables contains text that can't legitimately be converted to numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get rid of the message by adding ??:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_num(i) = input(_char(i), ??6.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That doesn't fix the problem, just covers it up.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 21:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255940#M48964</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-10T21:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255944#M48966</link>
      <description>&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&amp;nbsp;says it is likely a data issue.&lt;/P&gt;
&lt;P&gt;If I were worried about missing an intended conversion I would do a proc freq on the text variables.&lt;/P&gt;
&lt;P&gt;For instance if the data has values that are displayed with accounting rules like (1234) to indicate that the value is negative you may not want that be set to missing as your current data would. Other likely things would be currency symbols or&amp;nbsp;commas as part of the values.&lt;/P&gt;
&lt;P&gt;Of course if you have incoming values like NULL or N/A or such and those are the only suspect values then you're golden.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 21:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/255944#M48966</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-10T21:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/256038#M49013</link>
      <description>&lt;P&gt;Inspect your data.&lt;/P&gt;
&lt;P&gt;The NOTE will also supply the number (_N_) of the current iteration when the transformation error happened, so you know which observation(s) was(were) the culprit.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 08:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/256038#M49013</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-11T08:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/256059#M49019</link>
      <description>&lt;P&gt;Post some example test data (in the form of a datastep). &amp;nbsp;I would also check the structure of your data, why have 15 variables which seem to get assigned to a _xxxxx variable name? &amp;nbsp;Where does the _xxxxx even come from? &amp;nbsp;I would suggest for ease of doing anything to the data you normlise it, i.e. have a long dataset rather than a wide. &amp;nbsp;Now this code is just a guess:&lt;/P&gt;
&lt;PRE&gt;data conversion_subset (keep=variable char_result result);
  set dropping_strings;
  length variable char_result $100 result 8;
  array var{15};
  array lab{15} ("100400","100500","100600","200100","200200","200300","200400","200401","400402","400403","400601","400602","500800","500900","501000");
  do i=1 to dim(var);
    variable=lab{i};
    char_result=var{i};
    result=input(var{i},best.);
    output;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;But what it should do is give you a dataset which looks something like:&lt;/P&gt;
&lt;P&gt;VARIABLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CHAR_RESULT &amp;nbsp; &amp;nbsp; RESULT&lt;/P&gt;
&lt;P&gt;100400 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;123&lt;/P&gt;
&lt;P&gt;100500 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; abc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;You will see its far easier to conver a column of data rather than lots of columns, and you also get the benefit of by group processing. &amp;nbsp;If later on you need a transposed output, then proc transpose at that point. &amp;nbsp;Doing the above will also show you quite clearly where a value has not been converted, and what it contains - see the "abc" and missing result. &amp;nbsp;You can then put data cleaning if statements around the result= step.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 10:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/256059#M49019</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-11T10:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430020#M106262</link>
      <description>&lt;P&gt;add to the loop&lt;/P&gt;&lt;P&gt;if&amp;nbsp;prxmatch("/(?i)([a-z])/",&lt;SPAN&gt;_char(i)&lt;/SPAN&gt;)&amp;lt;=0&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will by pass any with alphabetic characters in the string&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 15:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430020#M106262</guid>
      <dc:creator>timeless</dc:creator>
      <dc:date>2018-01-23T15:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430032#M106268</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113602"&gt;@timeless&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;add to the loop&lt;/P&gt;
&lt;P&gt;if&amp;nbsp;prxmatch("/(?i)([a-z])/",&lt;SPAN&gt;_char(i)&lt;/SPAN&gt;)&amp;lt;=0&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will by pass any with alphabetic characters in the string&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113602"&gt;@timeless&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Using ?? as part of the input statement like already suggested is much more efficient than using a RegEx. The ?? syntax will also ALWAYS work if an informat doesn't apply to an input value where I believe your RegEx wouldn' capture "invalid" strings with digits and blanks only, i.e. something like "999&amp;nbsp; 999"&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 15:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430032#M106268</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-01-23T15:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430056#M106276</link>
      <description>&lt;P&gt;For some reason ?? gives me an error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Expecting a format name.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 16:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430056#M106276</guid>
      <dc:creator>timeless</dc:creator>
      <dc:date>2018-01-23T16:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430061#M106280</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113602"&gt;@timeless&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;For some reason ?? gives me an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Expecting a format name.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You still need to give it a format. Just add the ?? before the format specification.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(xxx,??6.)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jan 2018 16:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430061#M106280</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-23T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430064#M106282</link>
      <description>&lt;P&gt;That was exactly what I was doing&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 16:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430064#M106282</guid>
      <dc:creator>timeless</dc:creator>
      <dc:date>2018-01-23T16:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430065#M106283</link>
      <description>&lt;P&gt;Please post the log of the whole step that produces the error.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 16:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/430065#M106283</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-23T16:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/781773#M249164</link>
      <description>Good suggestions ballardw. I receive the same note when converting a character variable to numeric using input(). I made a frequency table for my original character variable and searched for all symbols and characters, even searching for space but did not find anything. &lt;BR /&gt;I wonder how I may use the hint for LINE and COLUMN to locate the variable causing the issue. Thanks!</description>
      <pubDate>Mon, 22 Nov 2021 20:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/781773#M249164</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-11-22T20:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: Invalid argument to function INPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/781779#M249166</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113602"&gt;@timeless&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;That was exactly what I was doing&lt;IMG id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check your program and SAS log more carefully.&amp;nbsp; The only way to get that message is to not include a format specification. If you include an invalid format specification you get a different error message.&lt;/P&gt;
&lt;PRE&gt;718   data _null_;
719     input string $20.;
720     num1=input(string,20.);
721     num2=input(string,??20.);
722     num3=input(string,??);
                            -
                            22
                            76
723     num4=input(string,);
                          -
                          22
                          76
724     num5=input(string,1234);
                          ----
                          85
                          76
ERROR 22-322: Expecting a format name.

ERROR 76-322: Syntax error, statement will be ignored.

ERROR 85-322: Expecting a format name.

725   cards;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Nov 2021 20:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Invalid-argument-to-function-INPUT/m-p/781779#M249166</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-22T20:37:52Z</dc:date>
    </item>
  </channel>
</rss>

