<?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 variable - dynamically increment date month in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844154#M82261</link>
    <description>&lt;P&gt;thanks ! super helpful now I see the logic.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 15:46:22 GMT</pubDate>
    <dc:creator>ogrigny</dc:creator>
    <dc:date>2022-11-14T15:46:22Z</dc:date>
    <item>
      <title>macro variable - dynamically increment date month</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844130#M82259</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to automatically calculate a date in macro variable that corresponds to the 2nd of the following month (i.e. if the code runs in November, the desired date will be 02dec2022).&lt;/P&gt;&lt;P&gt;I use this code to get the 2nd of the current month:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let wanted_day=2;
%put &amp;amp;wanted_day;

%let wanted_date=%sysfunc(MDY(%sysfunc(month(%sysfunc(today()))),%sysevalf(&amp;amp;wanted_day.),%sysfunc(year(%sysfunc(today())))),date9.);
%put &amp;amp;wanted_date;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can I change it to shift the month or do I need another approach?&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 14:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844130#M82259</guid>
      <dc:creator>ogrigny</dc:creator>
      <dc:date>2022-11-14T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable - dynamically increment date month</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844143#M82260</link>
      <description>&lt;P&gt;First, get this to work in a DATA step, much simpler with fewer %SYSFUNC calls (actually 0 %SYSFUNC calls) and fewer parentheses to possibly mismatch. Then you can use CALL SYMPUTX to create the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let wanted_day=2;
data _null_;
    date=today();
    day_of_next_month=intnx('month',date,1,'b')+(&amp;amp;wanted_day-1);
    call symputx('wanted_date',day_of_next_month);
run;
%put &amp;amp;=wanted_date;
%put %sysfunc(putn(&amp;amp;wanted_date,date9.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 15:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844143#M82260</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-14T15:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable - dynamically increment date month</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844154#M82261</link>
      <description>&lt;P&gt;thanks ! super helpful now I see the logic.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 15:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-variable-dynamically-increment-date-month/m-p/844154#M82261</guid>
      <dc:creator>ogrigny</dc:creator>
      <dc:date>2022-11-14T15:46:22Z</dc:date>
    </item>
  </channel>
</rss>

