<?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: need to get last 4 calendar dates from the date indicated in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816861#M322466</link>
    <description>&lt;P&gt;Use built-in SAS functions to compute months (and all calendar arithmetic)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yearmt=202201;
%let yearmtn=%sysfunc(inputn(&amp;amp;yearmt,yymmn6.));

%macro dothis;
    %do i=1 %to 6;
        %let thismonth=%sysfunc(intnx(month,&amp;amp;yearmtn,%eval(&amp;amp;i*-3),b));
        %put %sysfunc(putn(&amp;amp;thismonth,yymmn6.));
    %end;
%mend;
%dothis&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Jun 2022 14:02:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-07T14:02:44Z</dc:date>
    <item>
      <title>need to get last 4 calendar dates from the date indicated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816859#M322464</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date as input and I need to get last 6 dates in a continues manner for the same gap between dates.&lt;/P&gt;&lt;P&gt;for eg I have a date %let yearmt = 202201 so I need dates as 202110 ,202107,202104,202101,202010,202007 . How can I calculate it using a macro?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kajal&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:58:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816859#M322464</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2022-06-07T13:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: need to get last 4 calendar dates from the date indicated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816861#M322466</link>
      <description>&lt;P&gt;Use built-in SAS functions to compute months (and all calendar arithmetic)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yearmt=202201;
%let yearmtn=%sysfunc(inputn(&amp;amp;yearmt,yymmn6.));

%macro dothis;
    %do i=1 %to 6;
        %let thismonth=%sysfunc(intnx(month,&amp;amp;yearmtn,%eval(&amp;amp;i*-3),b));
        %put %sysfunc(putn(&amp;amp;thismonth,yymmn6.));
    %end;
%mend;
%dothis&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2022 14:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816861#M322466</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-07T14:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: need to get last 4 calendar dates from the date indicated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816862#M322467</link>
      <description>&lt;P&gt;Why does the subject line for your post say "4 calendar dates" and the body of the question "last 6 dates"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given any "date" what is the rule for determining what the dates would be? I can guess but really would prefer not to rely on guesses when programming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do all of the values go into one macro variable? 4 macro variables? 6 macro variables? Data step variable(s)? In other words, what is the result to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: Macro variables are text. So 202201 is not a "date" but 6 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 14:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/816862#M322467</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-07T14:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: need to get last 4 calendar dates from the date indicated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/817762#M322788</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 12:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-get-last-4-calendar-dates-from-the-date-indicated/m-p/817762#M322788</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2022-06-13T12:13:43Z</dc:date>
    </item>
  </channel>
</rss>

