<?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: Code/algorithm to determine if a date/time was during Daylight Savings Time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83323#M17973</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, yes, that would be nice; although I would settle for code or algorithm that works in Rochester, NY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should add that the code or algorithm that I hope to find would work going back for at least a decade.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 May 2013 20:05:46 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2013-05-22T20:05:46Z</dc:date>
    <item>
      <title>Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83321#M17971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Anybody know of SAS code, or mathematical algorithm, that can determine if a date/time value was during Daylight Savings Time or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 19:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83321#M17971</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-22T19:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83322#M17972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anywhere on Earth? &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 19:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83322#M17972</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-05-22T19:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83323#M17973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, yes, that would be nice; although I would settle for code or algorithm that works in Rochester, NY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should add that the code or algorithm that I hope to find would work going back for at least a decade.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 20:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83323#M17973</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-22T20:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83324#M17974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is how I would code it for years &amp;gt;= 2007 (the change dates were different before). If you want datetimes, you will have to take into account that the switch occurs at 2AM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want(drop=year);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;format myDate DSTbegin DSTend date9.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;call streaminit(23356);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do year = 2007 to 2025;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* random date */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDate = intnx("DAY", mdy(1,1,year), floor(rand("UNIFORM")*364));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* second Sunday of March */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DSTbegin = intnx("WEEK", intnx("DAY",mdy(3, 1, year(myDate)), -1), 2);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* first Sunday of November */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DSTend = intnx("DAY",intnx("WEEK", mdy(10, 31, year(myDate)), 1), -1);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DST = DSTbegin &amp;lt;= myDate &amp;lt;= DSTend; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print; id myDate; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can check the dates against&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="http://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States"&gt;http://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 22:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83324#M17974</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-05-23T22:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83325#M17975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Impressive work! I will have to see if I can adapt this to pre-2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, there appears to be errors in DSTend, they are off by a day on a couple of years. I'll have to see if I can come up with a fix&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 12:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83325#M17975</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-24T12:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83326#M17976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DSTend is not the first day of the non-DST period, it is the last DST day, the day before. I choose to use that date so that it could be used in a SQL condition like WHERE date BETWEEN DSTbegin AND DSTend. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 12:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83326#M17976</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-05-24T12:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83327#M17977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See &lt;A class="active_link" href="http://blogs.sas.com/content/iml/2012/10/29/computing-dst/" title="http://blogs.sas.com/content/iml/2012/10/29/computing-dst/"&gt; Computing the onset and end of daylight saving time in SAS: The EASY way! - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;An earlier version (&lt;A href="http://blogs.sas.com/content/iml/2012/03/08/using-sas-to-compute-the-onset-of-daylight-saving-time/" title="http://blogs.sas.com/content/iml/2012/03/08/using-sas-to-compute-the-onset-of-daylight-saving-time/"&gt; Spring forward, fall back: Using SAS to compute the onset of daylight saving time - The DO Loop&lt;/A&gt;) used PG's approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 12:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83327#M17977</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-05-24T12:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83328#M17978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great stuff, Rick! Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 15:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83328#M17978</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-24T15:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Code/algorithm to determine if a date/time was during Daylight Savings Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83329#M17979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a published sample that accounts for before and after 2007:&lt;/P&gt;&lt;P&gt;Sample &lt;EM&gt;24735: &lt;/EM&gt;Compute daylight saving time&lt;/P&gt;&lt;P&gt;&lt;SPAN style="padding: 0px 5px;"&gt;&lt;A class="active_link" href="http://support.sas.com/kb/24735" target="_blank"&gt;http://support.sas.com/kb/24735&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 15:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-algorithm-to-determine-if-a-date-time-was-during-Daylight/m-p/83329#M17979</guid>
      <dc:creator>jwsquillace</dc:creator>
      <dc:date>2013-05-24T15:44:38Z</dc:date>
    </item>
  </channel>
</rss>

