<?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 ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not a n in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836855#M330883</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to convert a macro variable with the following value&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;30Nov2019&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;into&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;20191130&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I am getting the error of :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
 ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution of %SYSCALL statement or %SYSFUNC 
        or %QSYSFUNC function reference is terminated.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Below is my script&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let rpt_date=30Nov2021;
%let rpt_date2=%sysfunc(put(&amp;amp;rpt_date.,yymmddn8.));
%put rpt_date2 is &amp;amp;rpt_date2.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned above, what I want to achieve is to convert rpt_date into a macro variable (rpt_date2) that shows character value in YYYYMMDD. However, I am getting error.&lt;/P&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;What could possible be wrong when converting the function that works in a datastep into a macro variable?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 04:14:30 GMT</pubDate>
    <dc:creator>StickyRoll</dc:creator>
    <dc:date>2022-10-05T04:14:30Z</dc:date>
    <item>
      <title>ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not a n</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836855#M330883</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to convert a macro variable with the following value&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;30Nov2019&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;into&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;20191130&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I am getting the error of :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
 ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution of %SYSCALL statement or %SYSFUNC 
        or %QSYSFUNC function reference is terminated.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Below is my script&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let rpt_date=30Nov2021;
%let rpt_date2=%sysfunc(put(&amp;amp;rpt_date.,yymmddn8.));
%put rpt_date2 is &amp;amp;rpt_date2.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned above, what I want to achieve is to convert rpt_date into a macro variable (rpt_date2) that shows character value in YYYYMMDD. However, I am getting error.&lt;/P&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;What could possible be wrong when converting the function that works in a datastep into a macro variable?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 04:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836855#M330883</guid>
      <dc:creator>StickyRoll</dc:creator>
      <dc:date>2022-10-05T04:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836859#M330886</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let rpt_date2 = %sysfunc(inputn("&amp;amp;rpt_date."d,date9.),yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try this.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 04:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836859#M330886</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-05T04:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836874#M330895</link>
      <description>&lt;P&gt;I am getting this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; 116        %put rpt_date is what i dont want &amp;amp;rpt_date.;
 SYMBOLGEN:  Macro variable RPT_DATE resolves to 31DEC2019
 rpt_date is what i dont want 31DEC2019
 117        %let rpt_date2 = %sysfunc(inputn("&amp;amp;rpt_date."d,date9.),yymmddn8.);
 SYMBOLGEN:  Macro variable RPT_DATE resolves to 31DEC2019
 WARNING: Argument 1 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
 NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set 
       to a missing value.
 118        %put rpt_date2 is what i want &amp;amp;rpt_date2.;
 SYMBOLGEN:  Macro variable RPT_DATE2 resolves to .
 rpt_date2 is what i want .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What could possibly be the issue here?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 05:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836874#M330895</guid>
      <dc:creator>StickyRoll</dc:creator>
      <dc:date>2022-10-05T05:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836875#M330896</link>
      <description>&lt;P&gt;You cannot use the PUT() function with %SYSFUNC().&amp;nbsp; It is too confusing to %SYSFUNC() to figure out if the value is numeric or character, so you need to tell %SYSFUNC() what type of values to expect by choosing to use either PUTN() or PUTC().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the YYMMDDN format is a NUMBERIC format you need to use the PUTN() function.&lt;/P&gt;
&lt;P&gt;But the PUTN() function operates on NUMBERS.&amp;nbsp; You passed it a string with letters in it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want SAS to consider that string as a date you need to convert it to a date literal by adding quotes and the letter D.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1      %let rpt_date=30Nov2021;
2      %let rpt_date2=%sysfunc(putn("&amp;amp;rpt_date"d,yymmddn8.));
3      %put &amp;amp;=rpt_date &amp;amp;=rpt_date2;
RPT_DATE=30Nov2021 RPT_DATE2=20211130

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 05:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836875#M330896</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-05T05:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Argument 1 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836877#M330897</link>
      <description>&lt;P&gt;My bad (posted before sufficient amount of caffeine).&lt;/P&gt;
&lt;P&gt;No date literal needed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let rpt_date2 = %sysfunc(inputn(&amp;amp;rpt_date.,date9.),yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See this log:&lt;/P&gt;
&lt;PRE&gt; 69         %let rpt_date = 31dec2019;
 70         
 71         %let rpt_date2 = %sysfunc(inputn(&amp;amp;rpt_date.,date9.),yymmddn8.);
 72         
 73         %put &amp;amp;=rpt_date2.;
 RPT_DATE2=20191231
&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Oct 2022 06:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Argument-1-to-function-PUTN-referenced-by-the-SYSFUNC-or/m-p/836877#M330897</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-05T06:14:39Z</dc:date>
    </item>
  </channel>
</rss>

