<?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: INTNX in macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723654#M224590</link>
    <description>&lt;P&gt;I am trying to do the same but I run into issues &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TD=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today());&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;TD;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%Let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; timtt= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intck('month',&amp;amp;TD,-1,'b'));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;=timtt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;LOG:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%Let timtt= %sysfunc(intck('month',&amp;amp;TD,-1,'b'));&lt;/P&gt;&lt;P&gt;29 %put &amp;amp;=timtt;&lt;/P&gt;&lt;P&gt;TIMTT=.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it spits out a "." . I have tried %Let timtt= %sysfunc(intck('month',&amp;amp;TD,-1,'b'),date9.); and still same thing. I have also removed the ' ' from 'month' and 'b' but still same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 21:22:19 GMT</pubDate>
    <dc:creator>MonaMir</dc:creator>
    <dc:date>2021-03-04T21:22:19Z</dc:date>
    <item>
      <title>INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/568671#M160135</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am using macro code to calculated sas date of two months before &amp;amp;start&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1901;
%let start2=%sysfunc(intnx('month',input("&amp;amp;start",yymmn4.),-2,'b'));
%put &amp;amp;start2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get an error&lt;/P&gt;
&lt;P&gt;ERROR: Required operator not found in expression: input("1901",yymmn4.) &lt;BR /&gt;ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;BR /&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC &lt;BR /&gt;or %QSYSFUNC function reference is terminated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 09:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/568671#M160135</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-06-25T09:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/568673#M160137</link>
      <description>&lt;P&gt;Every call of a data step function in a macro statement needs a %sysfunc() around it, and the put() and input() functions cannot be used in %sysfunc, so you need to use inputn():&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1901;
%let start2=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;start.,yymmn4.)),-2,b));
%put &amp;amp;start2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;24         %let start=1901;
25         %let start2=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;start.,yymmn4.)),-2,b));
26         %put &amp;amp;start2;
21489
&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 09:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/568673#M160137</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-25T09:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723654#M224590</link>
      <description>&lt;P&gt;I am trying to do the same but I run into issues &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TD=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today());&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;TD;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%Let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; timtt= &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intck('month',&amp;amp;TD,-1,'b'));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;=timtt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;LOG:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%Let timtt= %sysfunc(intck('month',&amp;amp;TD,-1,'b'));&lt;/P&gt;&lt;P&gt;29 %put &amp;amp;=timtt;&lt;/P&gt;&lt;P&gt;TIMTT=.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it spits out a "." . I have tried %Let timtt= %sysfunc(intck('month',&amp;amp;TD,-1,'b'),date9.); and still same thing. I have also removed the ' ' from 'month' and 'b' but still same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723654#M224590</guid>
      <dc:creator>MonaMir</dc:creator>
      <dc:date>2021-03-04T21:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723676#M224605</link>
      <description>&lt;P&gt;To the macro processor everything is text, so quote characters are just part of the text.&amp;nbsp; The INTNX() function knows about the MONTH interval but it knows nothing about an interval named 'MONTH'.&amp;nbsp; &amp;nbsp;Or target location of 'B'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INTCK() function allows last argument to be either C or D.&lt;/P&gt;
&lt;P&gt;Did you mean to call the INTNX() function instead?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723676#M224605</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-04T21:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723715#M224632</link>
      <description>&lt;P&gt;Thank you. rookie mistake (blushing).&amp;nbsp;but now I want to use CAT and I run into issues. I want to create '01FEB2021'd with the %let and %sysfunc but it seems that the %sysfunc inside the Cat function doesn't get recognized and I get the following result as if it just cats the %sysfunc and rest together:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%Let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; timtet=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(cat(',%sysfunc(intnx(month,&amp;amp;TD,-1,b),date9.),')); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;=timtet;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;LOG:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%Let timtet=%sysfunc(cat(',%sysfunc(intnx(month,&amp;amp;TD,-1,b),date9.),'));&lt;/P&gt;&lt;P&gt;29 %put &amp;amp;=timtet;&lt;/P&gt;&lt;P&gt;TIMTET=',%sysfunc(intnx(month,&amp;amp;TD,-1,b),date9.),'&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 23:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723715#M224632</guid>
      <dc:creator>MonaMir</dc:creator>
      <dc:date>2021-03-04T23:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723721#M224637</link>
      <description>&lt;P&gt;Why would you ever need to use CAT() in macro code?&amp;nbsp;Just expand the values where you want them.&lt;/P&gt;
&lt;P&gt;What are you trying to do?&amp;nbsp; If you want to make a date literal use double quotes so the macro function calls are processed.&amp;nbsp; Strings in single quote (which your code is creating by accident) are ignored by the macro processor.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Let timtet="%sysfunc(intnx(month,&amp;amp;TD,-1,b),date9.)"d;
%put &amp;amp;=timtet;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But why bother? SAS language does not care whether you give it "01FEB2021"d or&amp;nbsp;22312, they both represent the same number of days since 1960.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 23:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-in-macro/m-p/723721#M224637</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-04T23:25:32Z</dc:date>
    </item>
  </channel>
</rss>

