<?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: Sas date time for next weekday in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478544#M123407</link>
    <description>&lt;P&gt;How about this? No conditional code, but uses a Boolean expression instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format date_next date_now date9.;
  date_now = '14jul2018'd;
  date_next = intnx('WEEKDAY',date_now , (weekday(date_now) in (1,7)));
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Datetime version&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format date_next date_now datetime24.;
  date_now = '14jul2018:00:00:00'dt;
  date_next = intnx('DTWEEKDAY', date_now , (weekday(datepart(date_now)) in (1,7)));
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Jul 2018 03:54:45 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-07-17T03:54:45Z</dc:date>
    <item>
      <title>Sas date time for next weekday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478529#M123402</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;Is there any Sas function that returns the current date and time if it is a weekday but returns the next weekday’s date and time if it is saturday or Sunday ?&lt;BR /&gt;&lt;BR /&gt;Or do I need to write the conditional statement? If yes, any suggestions is appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 01:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478529#M123402</guid>
      <dc:creator>nickspencer</dc:creator>
      <dc:date>2018-07-17T01:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sas date time for next weekday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478544#M123407</link>
      <description>&lt;P&gt;How about this? No conditional code, but uses a Boolean expression instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format date_next date_now date9.;
  date_now = '14jul2018'd;
  date_next = intnx('WEEKDAY',date_now , (weekday(date_now) in (1,7)));
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Datetime version&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format date_next date_now datetime24.;
  date_now = '14jul2018:00:00:00'dt;
  date_next = intnx('DTWEEKDAY', date_now , (weekday(datepart(date_now)) in (1,7)));
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jul 2018 03:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478544#M123407</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-07-17T03:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sas date time for next weekday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478665#M123462</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;Super slick and elegant. Seems like an art to strike it big and at the right time to have that idea cross your mind in applying the right logic. Thank you for sharing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying a rather ugly way, lol-&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data w;
  format  date_now new_Date date9. ;

 do date_now = '10jun2018'd to '30jun2018'd;
 new_Date= (weekday(date_now)=7)*date_now+(2*(weekday(date_now)=7))
 +	(weekday(date_now)=1)*date_now+(1*(weekday(date_now)=1))+ (weekday(date_now) not in (1,7))*date_now	;
output;
end;

run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jul 2018 14:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478665#M123462</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-17T14:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sas date time for next weekday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478804#M123498</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;- thanks for the feedback. Not sure where ideas like that come from, but I do like using Boolean expressions a lot&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 19:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-date-time-for-next-weekday/m-p/478804#M123498</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-07-17T19:59:40Z</dc:date>
    </item>
  </channel>
</rss>

