<?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: Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267164#M52763</link>
    <description>October through December &amp;amp;last_year will actually contain a value of current year...</description>
    <pubDate>Fri, 29 Apr 2016 04:49:31 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-04-29T04:49:31Z</dc:date>
    <item>
      <title>Calculate historic date &amp; store in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267114#M52744</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a macro variable for last year and the month should be July(current month + 3) .&lt;/P&gt;
&lt;P&gt;For example : it should be display as 01JUL2015&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried the below.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'previous_year'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,put(intnx(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'month'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,today(),),intnx(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'year'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,today(), -&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'S'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'B'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;)); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;previous_year ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;01APR2015&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2016 10:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267114#M52744</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2016-04-29T10:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267116#M52746</link>
      <description>&lt;P&gt;It looks like you're making this a little too complicated.&amp;nbsp; How about:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call symput('previous_year', put(intnx('month', today(), -9), date9.));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last year + 3 months is the same as going back 9 months.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 21:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267116#M52746</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-28T21:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267119#M52748</link>
      <description>&lt;P&gt;Thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it should be automated for every month .If it runs for next month then it should be&amp;nbsp;August.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 21:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267119#M52748</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2016-04-28T21:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267120#M52749</link>
      <description>&lt;P&gt;Not a problem.&amp;nbsp; Your code already contains the today() function and the intnx function.&amp;nbsp; You might have to read the documentation to understand what they do.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 21:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267120#M52749</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-28T21:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267164#M52763</link>
      <description>October through December &amp;amp;last_year will actually contain a value of current year...</description>
      <pubDate>Fri, 29 Apr 2016 04:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267164#M52763</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-29T04:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267178#M52774</link>
      <description>&lt;P&gt;What is the point in putting a date in a macro variable? &amp;nbsp;You know the formula you want to use, so why not just use that in your code where you need to rather than setting up a text string (which is what a macro variable is), and then messing around with trying to use that as a date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2016 08:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267178#M52774</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-29T08:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267191#M52781</link>
      <description>&lt;P&gt;Well, one&amp;nbsp;reason could&amp;nbsp;be to use it in a where clause on an indexed variable. Function calls may prevent the index from&amp;nbsp;being used.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2016 10:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267191#M52781</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-29T10:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267192#M52782</link>
      <description>&lt;P&gt;Renamed the topic to better descibe the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2016 10:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-historic-date-amp-store-in-macro-variable/m-p/267192#M52782</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-29T10:31:33Z</dc:date>
    </item>
  </channel>
</rss>

