<?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: Flagging Holidays that fall on a weekend in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/484028#M125592</link>
    <description>&lt;P&gt;You can also use the Holiday Functions to return the US holidays, it seems like Good Friday may not be included though.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0jeu57edwueiwn1gpvw2omkj6sr.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0jeu57edwueiwn1gpvw2omkj6sr.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Aug 2018 15:34:54 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-08-04T15:34:54Z</dc:date>
    <item>
      <title>Flagging Holidays that fall on a weekend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483980#M125571</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to think of a smart way to resolve this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of dates in SAS format and I want to just put a flag to show its a holiday. However, if the day falls on a weekend (Saturday or Sunday) then I want flag = 1 for the Monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg Christmas Day 25/12/2016 falls on a Sunday therefore I would the monday to be flagged as a holiday my output to be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;24/12/2016&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;25/12/2016&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;26/12/2016&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;27/12/2016&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;28/12/2016&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also Easter Sunday is flagged, but I need to flag the previous Friday (Good Friday) and the following monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In 2018, Easter Sunday was on 1st of April.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg. Easter&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;29/03/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;30/03/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;31/03/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;01/04/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;02/04/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;03/04/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&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;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;set date_list;&lt;BR /&gt;flag=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Christmas*/&lt;BR /&gt;if month(date) = 12 and day(date) = 25 then flag = 1;&lt;BR /&gt;if month(date) = 12 and day(date) = 25 and (Weekday(Date)=1 or&amp;nbsp;&lt;SPAN&gt;Weekday(Date)=7)&lt;/SPAN&gt;&amp;nbsp;then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;some code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Easter Sunday*/&lt;/P&gt;&lt;P&gt;if date = holiday('easter',year(date)) then flag =1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Need to Flag Previous Friday and Next Day After Easter (Monday)*/&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;run;&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>Sat, 04 Aug 2018 06:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483980#M125571</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-04T06:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging Holidays that fall on a weekend downame</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483985#M125573</link>
      <description>&lt;P&gt;I think you are over complicating the problem. Something like this (untested) does what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if put(DATE,date7.) =: '26DEC' and put(DATE,downame.)='Monday' then FLAG = 1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if put(DATE,date7.) =: '27DEC' and put(DATE,downame.)='Monday' then FLAG = 1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is also more legible.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Aug 2018 07:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483985#M125573</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-04T07:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging Holidays that fall on a weekend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483989#M125576</link>
      <description>&lt;P&gt;Why not check your holiday dates generically? This logic will work regardless of the holiday date specified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format holiday_date next_holiday_date date9.;
  holiday_date = '25Dec2016'd;
  if day(holiday_date) in (1,7) then next_holiday_date = intnx('WEEKDAY', holiday_date, 1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Aug 2018 08:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483989#M125576</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-08-04T08:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging Holidays that fall on a weekend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483993#M125578</link>
      <description>&lt;P&gt;Thanks Guys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have kept it simpler like you have suggested and it is working fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Easter I just created a Good Friday &amp;amp; Easter Monday variable by -2 days for Good Friday from the Easter Date and +1 Day for Easter Monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then just rejoined the dates back to the main dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Sat, 04 Aug 2018 10:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/483993#M125578</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-04T10:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging Holidays that fall on a weekend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/484028#M125592</link>
      <description>&lt;P&gt;You can also use the Holiday Functions to return the US holidays, it seems like Good Friday may not be included though.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0jeu57edwueiwn1gpvw2omkj6sr.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0jeu57edwueiwn1gpvw2omkj6sr.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Aug 2018 15:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-Holidays-that-fall-on-a-weekend/m-p/484028#M125592</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-04T15:34:54Z</dc:date>
    </item>
  </channel>
</rss>

