<?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: how to find the first monday after 5th of every month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/473180#M121389</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If 03-05-2018 is a Monday, shouldn't the program return 03-12-2018 instead of 03-05-2018?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would need a little tweaking, but only the OP can give us the definite answer.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 21:50:25 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-06-25T21:50:25Z</dc:date>
    <item>
      <title>how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472871#M121290</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to finds the first Monday after 5th of every month.&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following code to find the 5th of every month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rundate &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rundate=(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,today(),+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;))+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&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;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 05:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472871#M121290</guid>
      <dc:creator>SAS_INFO</dc:creator>
      <dc:date>2018-06-25T05:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472883#M121295</link>
      <description>&lt;P&gt;You are using the correct function, but the parameters are wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bob;
   fifth = '05Jun2018'd;
   target = intnx('WEEK', fifth, 1, 'B') + 1;

   format fifth target ddmmyyp10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What do you expect if the 5th is a Monday?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 07:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472883#M121295</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-06-25T07:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472899#M121299</link>
      <description>&lt;P&gt;Use a formula that is based on weekday(), and create a modulated offset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input mydate yymmdd10.;
fifth = intnx('month',mydate,0,'b') + 4;
mon_after_fifth = fifth + mod(9 - weekday(fifth),7);
format mydate fifth mon_after_fifth yymmddd10.;
wd = weekday(mon_after_fifth); /* just to be sure we always get a monday */
cards;
2018-06-02
2018-05-10
2018-03-02
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I put the March date in because 2018-03-05 was a Monday.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 08:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472899#M121299</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-25T08:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472919#M121303</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32726"&gt;@SAS_INFO&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Can't think of anything much prettier than below to return for any given current_date a run_date of the next Monday of the month on the 5th or after AND this run_date also always being &amp;gt;= &lt;SPAN&gt;current_date&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  format currdate rundate _mon5orAfter weekdate17.;
  do currdate='01jan2018'd to today();
    _mon5orAfter=intnx('week.3',intnx('month',currdate,0,'b')+4,0,'e');
    rundate=ifn(currdate&amp;gt;_mon5orAfter,intnx('week.3',intnx('month',currdate,1,'b')+4,0,'e'),_mon5orAfter);
    output;
  end;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 10:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/472919#M121303</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-25T10:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/473033#M121338</link>
      <description>&lt;P&gt;If 03-05-2018 is a Monday, shouldn't the program return 03-12-2018 instead of 03-05-2018?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/473033#M121338</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-25T15:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the first monday after 5th of every month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/473180#M121389</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If 03-05-2018 is a Monday, shouldn't the program return 03-12-2018 instead of 03-05-2018?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would need a little tweaking, but only the OP can give us the definite answer.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 21:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-first-monday-after-5th-of-every-month/m-p/473180#M121389</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-25T21:50:25Z</dc:date>
    </item>
  </channel>
</rss>

