<?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: Error: Numeric format f in put function requires a numeric argument. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741737#M231909</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It's a mystery to me.&lt;/P&gt;
&lt;P&gt;But try to to use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;is not missing&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;ne ' ' or ne ''&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;lt; is not missing &amp;gt;&amp;gt; is agnostic for variable type. Variable can be char or num, doesn't matter then.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Sun, 16 May 2021 14:09:31 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-05-16T14:09:31Z</dc:date>
    <item>
      <title>Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741722#M231895</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is :&lt;/P&gt;&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;create tale Engager as&amp;nbsp;&lt;/P&gt;&lt;P&gt;select date, CLNT_BEO_SEG_CDE , count(*) as count&lt;/P&gt;&lt;P&gt;from BEO&lt;/P&gt;&lt;P&gt;where put(ccsid, 25.) ne '&amp;nbsp; '&amp;nbsp; and&amp;nbsp;CLNT_BEO_SEG_CDE = 'Engager'&lt;/P&gt;&lt;P&gt;group by date,&amp;nbsp;CLNT_BEO_SEG_CDE&lt;/P&gt;&lt;P&gt;order by count;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;i am getting error :&amp;nbsp;Numeric format f in put function requires a numeric argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 12:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741722#M231895</guid>
      <dc:creator>anandmgjsa</dc:creator>
      <dc:date>2021-05-16T12:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741727#M231900</link>
      <description>&lt;P&gt;ccsid is character, so you do not need the format and the PUT function to test for a missing value.&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 13:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741727#M231900</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-16T13:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741728#M231901</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the error message is quit clear, no?&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;'ccsid' is a character variable (character argument).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You get the same error when submitting this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
 select *
 from sashelp.class
 where put(name,25.) is not missing;
QUIT;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Numeric format F in PUT function requires a numeric argument.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 13:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741728#M231901</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-16T13:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741729#M231902</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put(ccsid,25.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;requires variable CCSID to be numeric (and apparently it is not).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help us all out, from now on please show us the entire LOG of this PROC SQL (including the code, ERRORs, WARNINGs and NOTEs), not just selected parts. Please paste the log into the window that appears when you click on the &amp;lt;/&amp;gt; icon, this preserves the formatting of the log and makes it more readable — &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;DO NOT SKIP THIS STEP&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 13:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741729#M231902</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-16T13:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741734#M231907</link>
      <description>&lt;P&gt;even if i don't use put function, it's giving error.&lt;/P&gt;&lt;P&gt;error is : expression using not equals (^=) has components that are of different data types.&lt;/P&gt;&lt;P&gt;I can not paste the log as it's on VDI and I can not copy/snip from it.&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 14:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741734#M231907</guid>
      <dc:creator>anandmgjsa</dc:creator>
      <dc:date>2021-05-16T14:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741737#M231909</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It's a mystery to me.&lt;/P&gt;
&lt;P&gt;But try to to use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;is not missing&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;ne ' ' or ne ''&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;lt; is not missing &amp;gt;&amp;gt; is agnostic for variable type. Variable can be char or num, doesn't matter then.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 14:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741737#M231909</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-16T14:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741740#M231911</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
create tale Engager as 
select date, CLNT_BEO_SEG_CDE , count(*) as count
from BEO
where ccsid ne '  '  and CLNT_BEO_SEG_CDE = 'Engager'
group by date, CLNT_BEO_SEG_CDE
order by count;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this still throws a message, look at the variable types as reported by PROC CONTENTS for both ccsid and CLNT_BEO_SEG_CDE.&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 14:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741740#M231911</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-16T14:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741746#M231916</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/380276"&gt;@anandmgjsa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;even if i don't use put function, it's giving error.&lt;/P&gt;
&lt;P&gt;error is : expression using not equals (^=) has components that are of different data types.&lt;/P&gt;
&lt;P&gt;I can not paste the log as it's on VDI and I can not copy/snip from it.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you can't copy and paste then you have to be extra careful what you type. "Create &lt;STRONG&gt;tale&lt;/STRONG&gt; Engager" ????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I notice that you do not provide the actual code from:&lt;/P&gt;
&lt;PRE&gt;even if i don't use put function, it's giving error.

error is : expression using not equals (^=) has components that are of different data types.&lt;/PRE&gt;
&lt;P&gt;So I suspect you did something that does not compare the NUMERIC value of CCSID properly.&lt;/P&gt;
&lt;P&gt;My &lt;STRONG&gt;guess&lt;/STRONG&gt; is you used something like&lt;/P&gt;
&lt;PRE&gt;where ccsid ne '  '  and CLNT_BEO_SEG_CDE = 'Engager'&lt;/PRE&gt;
&lt;P&gt;which is the wrong way to compare numeric values as missing because ' ' is not a numeric value.&lt;/P&gt;
&lt;P&gt;You could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ccsid ne . and ...&lt;/P&gt;
&lt;P&gt;or better (as said by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; not missing(ccsid) and ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have some objection to using PROC CONTENTS to actually examine your variables? We have to guess because you are showing errors and we don't have data or actual descriptions of your variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 15:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/741746#M231916</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-16T15:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Numeric format f in put function requires a numeric argument.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/828447#M327256</link>
      <description>&lt;P&gt;This response summarizes the excellent feedback provided by &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_blank" rel="noopener"&gt;Kurt_Bremser&lt;/A&gt;, &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892" target="_blank" rel="noopener"&gt;PaigeMiller&lt;/A&gt;, &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547" target="_blank" rel="noopener"&gt;sbxkoenk&lt;/A&gt;, and &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884" target="_blank" rel="noopener"&gt;ballardw&lt;/A&gt; in previous comments. First, some code to create the input table and demonstrate the original problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BEO;
	infile datalines truncover;
	input ccsid:$10. date:mmddyy10. CLNT_BEO_SEG_CDE:$20.;
datalines;
L100 02/21/2022 Lurker
E101 03/10/2022 Engager
D102 04/10/2022 Disengaged
E104 05/12/2022 Engager
E105 05/12/2022 Engager
E106 05/12/2022 Engager
;

proc sql;
create table Engager as 
	select date, CLNT_BEO_SEG_CDE, count(*) as count
		from BEO
		where put(ccsid, 25.) ne ' '  
		  and CLNT_BEO_SEG_CDE = 'Engager'
		group by date, CLNT_BEO_SEG_CDE
		order by count
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;ERROR: Numeric format F in the PUT function requires a numeric argument.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The error message indicates that the PUT function call is trying to apply a numeric format (&lt;STRONG&gt;25.&lt;/STRONG&gt;) to a character argument (&lt;STRONG&gt;cssid)&lt;/STRONG&gt;. When testing for missing values, it’s better to use syntax that doesn’t require you to detect and/or convert argument data types. Your original expression:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where &lt;STRONG&gt;put(ccsid, 25.) ne ' '  &lt;/STRONG&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;would be better expressed using either the “is not missing” WHERE statement syntax, or using the MISSING function, which works in any expression. Both expressions will produce consistent results for both character and numeric values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where &lt;STRONG&gt;ccsid is not missing&lt;/STRONG&gt; 
where &lt;STRONG&gt;not missing(ccsid) &lt;/STRONG&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You reported getting errors even after eliminating the PUT function, but I could not replicate any condition where the expression still produced an error and you did not provide a copy of the code. This solution, originally supplied by &amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_blank" rel="noopener"&gt;Kurt_Bremser&lt;/A&gt;, runs without error and produces the correct result set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Engager as 
	select date, CLNT_BEO_SEG_CDE, count(*) as count
		from BEO
		where&lt;STRONG&gt; ccsid ne ' ' &lt;/STRONG&gt; 
		  and CLNT_BEO_SEG_CDE = 'Engager'
		group by date, CLNT_BEO_SEG_CDE
		order by count
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#3366FF"&gt;NOTE: Table WORK.ENGAGER created, with 2 rows and 3 columns.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This proposed alternative solution also ran without error and produced the correct results:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Engager as 
   select date, CLNT_BEO_SEG_CDE , count(*) as count
      from BEO
      where not missing(ccsid)
        and CLNT_BEO_SEG_CDE = 'Engager'
      group by date, CLNT_BEO_SEG_CDE
      order by count
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#3366FF"&gt;NOTE: Table WORK.ENGAGER created, with 2 rows and 3 columns.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;May the SAS be with you!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Mark&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 20:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Numeric-format-f-in-put-function-requires-a-numeric/m-p/828447#M327256</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-08-12T20:10:39Z</dc:date>
    </item>
  </channel>
</rss>

