<?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: SQL macro variable Today plus 6 months in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475689#M122332</link>
    <description>&lt;P&gt;&lt;SPAN&gt;%let Date6mths=%sysfunc(INTNX(Month,%sysfunc(Today()),6,s));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;No quotes here, quotes would be wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jul 2018 15:29:20 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-05T15:29:20Z</dc:date>
    <item>
      <title>SQL macro variable Today plus 6 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475678#M122325</link>
      <description>&lt;P&gt;I would like to put a macro variable that would reference Today plus 6 months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my initial statement I use to change the date manually in my macro and it works fine but now I want to upgrade my macro so that it calculate Today plus 6 months without me changing it manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original statement look like this : %let Date6mths=5JAN2018;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried a couple of variation of this code to have this date automatically calculated from the date of production:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Date6mths="%sysfunc(INTNX(Month,Today(),6,s))";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- with double quote around the %sysfunc&lt;/P&gt;&lt;P&gt;- without double quote and with single quote for the parameter within the Intnx function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I also tried this variation : %let Date6mths=INTNX('Month',Today(),6,'s'))";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the macro within a Proc SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx you all for your help&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 15:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475678#M122325</guid>
      <dc:creator>JMart</dc:creator>
      <dc:date>2018-07-05T15:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL macro variable Today plus 6 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475688#M122331</link>
      <description>&lt;P&gt;And why do you need one?&amp;nbsp; You already have the logic which you can use in the code:&lt;/P&gt;
&lt;PRE&gt;intnx('month',today(),6,'s)
&lt;/PRE&gt;
&lt;P&gt;So just populate that through the code where you need to use the date + 6 months.&amp;nbsp; Saves code creating that, storage of a macro variable which is text to hold it, then more code to convert it to numeric when used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh, and to correct your code you don't need the double quotes around the sysfunc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 15:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475688#M122331</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-05T15:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: SQL macro variable Today plus 6 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475689#M122332</link>
      <description>&lt;P&gt;&lt;SPAN&gt;%let Date6mths=%sysfunc(INTNX(Month,%sysfunc(Today()),6,s));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;No quotes here, quotes would be wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 15:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475689#M122332</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-05T15:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: SQL macro variable Today plus 6 months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475691#M122334</link>
      <description>&lt;P&gt;Probably close enough:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;%let result &lt;/FONT&gt;&lt;FONT face="Lucida Console" size="2"&gt;=%sysfunc(INTNX(Month,&lt;/FONT&gt;&lt;FONT size="2"&gt;"&amp;amp;sysdate9"d&lt;/FONT&gt;&lt;FONT face="Lucida Console" size="2"&gt;,6,s)&lt;/FONT&gt;&lt;FONT size="2"&gt;,date9&lt;/FONT&gt;&lt;FONT face="Lucida Console" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Technically, &amp;amp;sysdate9 is set when the program begins to execute.&amp;nbsp; It contains the current date (just like the TODAY function), but it won't change if the program continues to execute past midnight.&amp;nbsp; In practice, most of the time nobody cares about that.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 15:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-macro-variable-Today-plus-6-months/m-p/475691#M122334</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-05T15:30:23Z</dc:date>
    </item>
  </channel>
</rss>

