<?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: Create dummy variable if date is any US federal holiday in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889740#M351557</link>
    <description>&lt;P&gt;There is a HolidayName() function, which returns blank if the date is not a holiday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  do date='01Jan2023'd to '31Dec2023'd ;
    Holiday=HolidayName(date) ;
    put date= Holiday= ;
  end ;
  format date date9. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Aug 2023 20:04:01 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-08-17T20:04:01Z</dc:date>
    <item>
      <title>Create dummy variable if date is any US federal holiday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889730#M351550</link>
      <description>&lt;P&gt;I would like to create an indicator/dummy variable to say whether or not the date (in this case, date of surgery) was on a US federal holiday. I have a date column and thousands of observations spanning multiple years of surgeries.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could do multiple do loops for each year and use the holiday() function within that year for each holiday (if date of surgery is equal to '4th of July' or "thanksgiving' then holiday_dummy=1, for example) , but I'm wondering if there's a more efficient way to accomplish this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 19:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889730#M351550</guid>
      <dc:creator>lsandell</dc:creator>
      <dc:date>2023-08-17T19:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummy variable if date is any US federal holiday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889731#M351551</link>
      <description>&lt;P&gt;Sorry to say, I don't have an answer for you.&amp;nbsp; It's an interesting question analytically, but how could you possibly control for the fact that different holidays mean different things to different people?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 19:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889731#M351551</guid>
      <dc:creator>awesome_opossum</dc:creator>
      <dc:date>2023-08-17T19:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummy variable if date is any US federal holiday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889735#M351555</link>
      <description>&lt;P&gt;Perhaps the Holidaycount function. It returns the number of holidays defined for a given date. Restricted to a single locale&lt;/P&gt;
&lt;PRE&gt;data example;
   do date= '01Jan2023'd to '31DEC2023'd;
     dummy = (holidaycount(date,'English_UnitedStates') &amp;gt; 0);
     output;
   end;
   format date date9.;
run;&lt;/PRE&gt;
&lt;P&gt;May need to fine tune a bit for your specific use as this does indicate "defined' and "observed" for the holidays like Christmas, Veteran's Day&amp;nbsp; and the 4th that move day of the week. Veteran's day may have two occurrences on the same day because there are two Federal rules for the holiday depending on whether you are US Postal office or other as the USPS usually works on Saturday and other agencies don't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 19:49:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889735#M351555</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-17T19:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummy variable if date is any US federal holiday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889740#M351557</link>
      <description>&lt;P&gt;There is a HolidayName() function, which returns blank if the date is not a holiday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  do date='01Jan2023'd to '31Dec2023'd ;
    Holiday=HolidayName(date) ;
    put date= Holiday= ;
  end ;
  format date date9. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2023 20:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889740#M351557</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-17T20:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummy variable if date is any US federal holiday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889743#M351559</link>
      <description>Thank you! I can see the utility of this function. I appreciate your quick response and help on this!</description>
      <pubDate>Thu, 17 Aug 2023 20:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-dummy-variable-if-date-is-any-US-federal-holiday/m-p/889743#M351559</guid>
      <dc:creator>lsandell</dc:creator>
      <dc:date>2023-08-17T20:25:26Z</dc:date>
    </item>
  </channel>
</rss>

