<?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 Cannot use Intnx with %sysfunc in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922858#M363360</link>
    <description>&lt;P&gt;I tried to run the code to add one month to&amp;nbsp;X='01Jan2021'd.&lt;/P&gt;
&lt;P&gt;First, I am not sure if I need to add inputc for X&lt;/P&gt;
&lt;P&gt;Second, the code cannot work&lt;/P&gt;
&lt;PRE&gt;%let X='01Jan2021'd; &lt;BR /&gt;%let Xnew = %sysfunc(INTNX('day',%sysfunc(inputc(&amp;amp;X,date9.)),31) date9.);&lt;BR /&gt;%put &amp;amp;X_new;&lt;/PRE&gt;
&lt;P&gt;Howover, I got the error message&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: Argument 2 to function INPUTC referenced by the %SYSFUNC or %QSYSFUNC macro function is out
         of range.
ERROR: Expected close parenthesis after macro function invocation not found.
3    %put &amp;amp;X_new;
WARNING: Apparent symbolic reference X_NEW not resolved.
&amp;amp;X_new
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaMoon_168_0-1712178798367.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95190i99C623E8206CD21E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaMoon_168_0-1712178798367.png" alt="SeaMoon_168_0-1712178798367.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2024 21:38:08 GMT</pubDate>
    <dc:creator>SeaMoon_168</dc:creator>
    <dc:date>2024-04-03T21:38:08Z</dc:date>
    <item>
      <title>Cannot use Intnx with %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922858#M363360</link>
      <description>&lt;P&gt;I tried to run the code to add one month to&amp;nbsp;X='01Jan2021'd.&lt;/P&gt;
&lt;P&gt;First, I am not sure if I need to add inputc for X&lt;/P&gt;
&lt;P&gt;Second, the code cannot work&lt;/P&gt;
&lt;PRE&gt;%let X='01Jan2021'd; &lt;BR /&gt;%let Xnew = %sysfunc(INTNX('day',%sysfunc(inputc(&amp;amp;X,date9.)),31) date9.);&lt;BR /&gt;%put &amp;amp;X_new;&lt;/PRE&gt;
&lt;P&gt;Howover, I got the error message&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: Argument 2 to function INPUTC referenced by the %SYSFUNC or %QSYSFUNC macro function is out
         of range.
ERROR: Expected close parenthesis after macro function invocation not found.
3    %put &amp;amp;X_new;
WARNING: Apparent symbolic reference X_NEW not resolved.
&amp;amp;X_new
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaMoon_168_0-1712178798367.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95190i99C623E8206CD21E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaMoon_168_0-1712178798367.png" alt="SeaMoon_168_0-1712178798367.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 21:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922858#M363360</guid>
      <dc:creator>SeaMoon_168</dc:creator>
      <dc:date>2024-04-03T21:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot use Intnx with %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922861#M363361</link>
      <description>&lt;P&gt;Your date is a date literal, you don't need to use the INPUT function to convert it.&amp;nbsp; Also, you don't need quotation marks around month because you are calling INTNX as part of the macro language, and the macro language doesn't use quotes to mark text.&amp;nbsp; And you were missing a comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X='01Jan2021'd; 
%let Xnew = %sysfunc(INTNX(month,&amp;amp;x,1), date9.);
%put &amp;amp;Xnew;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 21:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922861#M363361</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-04-03T21:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot use Intnx with %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922862#M363362</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X = 01Jan2021; 
%let X_new = %sysfunc(INTNX(DAY,"&amp;amp;x"d,31), date9.);
%put &amp;amp;X_new;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2024 21:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922862#M363362</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-04-03T21:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot use Intnx with %sysfunc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922863#M363363</link>
      <description>&lt;P&gt;Do you want to add one MONTH or 31 days?&lt;/P&gt;
&lt;P&gt;If you want to add a month use the MONTH interval.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X='01Jan2021'd; 
%let Xnew = "%sysfunc(INTNX(month,&amp;amp;X,1),date9.)"d;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to keep the same relative posistion in the month use an alignment value of SAME&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to add 31 days no matter what the then you can just use arithmetic as SAS stores dates as days.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X='01Jan2021'd; 
%let Xnew = "%sysfunc(putn(&amp;amp;X+31,date9.))"d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if you don't need the new date formatted so humans can read it you can just use %SYSEVALF() to do the addition.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X='01Jan2021'd; 
%let Xnew = %sysevalf(&amp;amp;x+31);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;1    %let X='01Jan2021'd;
2    %let Xnew = "%sysfunc(INTNX(month,&amp;amp;X,1),date9.)"d;
3    %put &amp;amp;=xnew;
XNEW="01FEB2021"d
4
5    %let X='01Jan2021'd;
6    %let Xnew = "%sysfunc(putn(&amp;amp;X+31,date9.))"d;
7    %Put &amp;amp;=xnew;
XNEW="01FEB2021"d
8
9    %let X='01Jan2021'd;
10   %let Xnew = %sysevalf(&amp;amp;x+31);
11   %Put &amp;amp;=xnew;
XNEW=22312
&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2024 21:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-use-Intnx-with-sysfunc/m-p/922863#M363363</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-04-03T21:53:45Z</dc:date>
    </item>
  </channel>
</rss>

