<?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 hour function not working when time &amp;gt; 24 hrs in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55642#M5844</link>
    <description>I have data that is coming in with timestamps with more than 24 hours...e.g. 26:32:17.&lt;BR /&gt;
&lt;BR /&gt;
When using the hour function on this timestamp, it returns 2 and not 26.&lt;BR /&gt;
&lt;BR /&gt;
How can I make it recognize 26 rather than 2? I tried converting the time-stamp into a character value and then parsing out the hour. However, that didn't work either.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
kdp</description>
    <pubDate>Fri, 22 Apr 2011 22:17:34 GMT</pubDate>
    <dc:creator>kdp</dc:creator>
    <dc:date>2011-04-22T22:17:34Z</dc:date>
    <item>
      <title>hour function not working when time &gt; 24 hrs</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55642#M5844</link>
      <description>I have data that is coming in with timestamps with more than 24 hours...e.g. 26:32:17.&lt;BR /&gt;
&lt;BR /&gt;
When using the hour function on this timestamp, it returns 2 and not 26.&lt;BR /&gt;
&lt;BR /&gt;
How can I make it recognize 26 rather than 2? I tried converting the time-stamp into a character value and then parsing out the hour. However, that didn't work either.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
kdp</description>
      <pubDate>Fri, 22 Apr 2011 22:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55642#M5844</guid>
      <dc:creator>kdp</dc:creator>
      <dc:date>2011-04-22T22:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: hour function not working when time &gt; 24 hrs</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55643#M5845</link>
      <description>I'm guessing a bit about how you're turning your timestamp into a datetime value, but I think your problem is the difference between a time and a duration. Inputting 26:32:17 is most likely creating a datetime of 2 AM, January 2 1960. So the HOUR function is correctly returning 2.&lt;BR /&gt;
&lt;BR /&gt;
The INTCK function returns information about an interval. If you ask for the number of hours in the interval between 12 AM January 1 1960 (datetime value 0) and your timestamp, you should get the correct 26.&lt;BR /&gt;
&lt;BR /&gt;
I've put together a small sample program to demonstrate the difference.&lt;BR /&gt;
&lt;BR /&gt;
Program&lt;BR /&gt;
----------&lt;BR /&gt;
&lt;BR /&gt;
data timetest;&lt;BR /&gt;
chartime = "26:32:17";&lt;BR /&gt;
timeval = input(chartime, time8.);&lt;BR /&gt;
file log;&lt;BR /&gt;
As_datetime = put(timeval, datetime.); put As_datetime =;&lt;BR /&gt;
As_hour = hour(timeval); put As_hour =;&lt;BR /&gt;
As_interval = intck("HOUR",0,timeval); put As_interval =;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Log&lt;BR /&gt;
---&lt;BR /&gt;
&lt;BR /&gt;
As_datetime=02JAN60:02:32:17&lt;BR /&gt;
As_hour=2&lt;BR /&gt;
As_interval=26</description>
      <pubDate>Fri, 22 Apr 2011 23:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55643#M5845</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2011-04-22T23:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: hour function not working when time &gt; 24 hrs</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55644#M5846</link>
      <description>Another option is to run the data-string as formatted value  then use INPUT to convert back to number.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
27   data _null_;&lt;BR /&gt;
28   hr = input(put('26:00:00't,hour.),best.);&lt;BR /&gt;
29   put hr= ;&lt;BR /&gt;
30   run;&lt;BR /&gt;
&lt;BR /&gt;
hr=26&lt;BR /&gt;
NOTE: DATA statement used ...</description>
      <pubDate>Sun, 24 Apr 2011 02:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55644#M5846</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-04-24T02:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: hour function not working when time &gt; 24 hrs</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55645#M5847</link>
      <description>Thanks guys! I knew someone would have an answer.</description>
      <pubDate>Mon, 25 Apr 2011 18:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/hour-function-not-working-when-time-gt-24-hrs/m-p/55645#M5847</guid>
      <dc:creator>kdp</dc:creator>
      <dc:date>2011-04-25T18:52:53Z</dc:date>
    </item>
  </channel>
</rss>

