<?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 One month back from today date in macro varaible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550680#M152913</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Today is 13 April 2018&lt;/P&gt;
&lt;P&gt;I want to get date one month back...(13 Mar 2018)&lt;/P&gt;
&lt;P&gt;What is wrong in the code that the result is 01Mar2018&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dts = "%sysfunc(today(),date9.)"d;
%put &amp;amp;dts;/*"12APR2019"d*/
%let w = "%sysfunc(intnx(MONTH,&amp;amp;dts,-1),date9.)"d;
%put &amp;amp;w;/*"01MAR2019"d*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Apr 2019 15:15:02 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-04-12T15:15:02Z</dc:date>
    <item>
      <title>One month back from today date in macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550680#M152913</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Today is 13 April 2018&lt;/P&gt;
&lt;P&gt;I want to get date one month back...(13 Mar 2018)&lt;/P&gt;
&lt;P&gt;What is wrong in the code that the result is 01Mar2018&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dts = "%sysfunc(today(),date9.)"d;
%put &amp;amp;dts;/*"12APR2019"d*/
%let w = "%sysfunc(intnx(MONTH,&amp;amp;dts,-1),date9.)"d;
%put &amp;amp;w;/*"01MAR2019"d*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 15:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550680#M152913</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-04-12T15:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: One month back from today date in macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550683#M152915</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;117  %let dts = %sysfunc(today());
118  %put &amp;amp;dts;/*"12APR2019"d*/
21651
119  %let w = %sysfunc(intnx(MONTH,&amp;amp;dts,-1,s),date9.);
120  %put &amp;amp;w;
12MAR2019
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For calculations, plz keep the Date value as numbers and avoid formats or using string literals.&lt;/P&gt;
&lt;P&gt;If you want, just format the final needed result as show above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus you need &lt;STRONG&gt;s&lt;/STRONG&gt;&amp;nbsp;option to get the same value of the previous month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 15:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550683#M152915</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-12T15:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: One month back from today date in macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550689#M152917</link>
      <description>&lt;P&gt;Nothing to do with macro.&lt;/P&gt;
&lt;P&gt;You need set the last parameter for the INTNX() function to SAME. If you don't specify a value the default is to use BEGINNING.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let w = "%sysfunc(intnx(MONTH,&amp;amp;dts,-1,s),date9.)"d;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 15:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/One-month-back-from-today-date-in-macro-varaible/m-p/550689#M152917</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-12T15:24:07Z</dc:date>
    </item>
  </channel>
</rss>

