<?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 Create a monthly adjustable program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732982#M228406</link>
    <description>&lt;P&gt;I have the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Importação para a memória da base de Janeiro*/;
Data D201901 (keep=U);
	Set D201901;
Run;

Data E201901s (keep=U);
	Set E201901s;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Instead of 201901 I want n-24, i.e., the 24th previous month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a monthly routine program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me writing the proper code?&lt;/P&gt;</description>
    <pubDate>Mon, 12 Apr 2021 12:27:40 GMT</pubDate>
    <dc:creator>ramgouveia</dc:creator>
    <dc:date>2021-04-12T12:27:40Z</dc:date>
    <item>
      <title>Create a monthly adjustable program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732982#M228406</link>
      <description>&lt;P&gt;I have the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Importação para a memória da base de Janeiro*/;
Data D201901 (keep=U);
	Set D201901;
Run;

Data E201901s (keep=U);
	Set E201901s;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Instead of 201901 I want n-24, i.e., the 24th previous month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a monthly routine program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me writing the proper code?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 12:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732982#M228406</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2021-04-12T12:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly adjustable program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732988#M228408</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/369095"&gt;@ramgouveia&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/369095"&gt;@ramgouveia&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;Instead of 201901 I want n-24, i.e., the 24th previous month.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean "&lt;EM&gt;today&lt;/EM&gt; minus 24 months"? If so, you can (at the beginning of your program) define a macro variable, say MON, in a way that dynamically creates the &lt;EM&gt;YYYYMM&lt;/EM&gt; expression by subtracting 24 months from the date when the program runs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mon=%sysfunc(intnx(month,%sysfunc(today()),-24),yymmn.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Submitted today, this yields &lt;FONT face="courier new,courier"&gt;201904&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then replace all occurrences of &lt;FONT face="courier new,courier"&gt;201901&lt;/FONT&gt; in your code by&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;&amp;amp;mon.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;For example, write&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;EFAT_&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;&amp;amp;mon.&lt;/STRONG&gt;&lt;/FONT&gt;s&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;instead of &lt;FONT face="courier new,courier"&gt;EFAT_&lt;FONT color="#FF0000"&gt;201901&lt;/FONT&gt;s&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732988#M228408</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-04-12T11:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly adjustable program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732991#M228410</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mon=%sysfunc(intnx(month,%sysfunc(today()),-24),yymmn.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Instead of today function how can I define a specific month?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732991#M228410</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2021-04-12T11:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly adjustable program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732992#M228411</link>
      <description>&lt;P&gt;Would you like to hardcode the "specific month" like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let basemon=202101;
%let mon=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;basemon,yymmn6.)),-24),yymmn.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This yields&amp;nbsp;&lt;FONT face="courier new,courier"&gt;201901&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732992#M228411</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-04-12T11:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly adjustable program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732993#M228412</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both solutions are useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second is best for us now.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monthly-adjustable-program/m-p/732993#M228412</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2021-04-12T11:42:17Z</dc:date>
    </item>
  </channel>
</rss>

