<?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: Proc SQL: Calculate the number of hours between two time variables with separate date variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290332#M60058</link>
    <description>&lt;P&gt;Thanks Reeza. This got me what I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dhms(event_end_date,0,0,(input(event_end_time, time.))) - dhms(event_begin_date,0,0,(input(event_begin_time, time.)))&lt;BR /&gt;format =time8. as duration,&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2016 21:23:14 GMT</pubDate>
    <dc:creator>ebills</dc:creator>
    <dc:date>2016-08-08T21:23:14Z</dc:date>
    <item>
      <title>Proc SQL: Calculate the number of hours between two time variables with separate date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290305#M60046</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the number of hours between two time variables in Proc SQL. That calculation is easy enough, but the obstacle I'm facing is the span between days. For instance, if an event happened on the 8th at 11:00pm and ended on the 9th at 4:00am, I want it to give me 5 hours. I have a beginning date (date9.) variable, an ending date (date9.) variable and the two (time10.) time variables (beginning/ending).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would I need to aggregate these to create datetime variables and then proceed to do the intck calculation from there?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated! Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2016 20:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290305#M60046</guid>
      <dc:creator>ebills</dc:creator>
      <dc:date>2016-08-08T20:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL: Calculate the number of hours between two time variables with separate date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290309#M60047</link>
      <description>&lt;P&gt;Look at the 6th example here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p1md4mx2crzfaqn14va8kt7qvfhr.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2016 20:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290309#M60047</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-08-08T20:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL: Calculate the number of hours between two time variables with separate date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290312#M60049</link>
      <description>&lt;P&gt;I would create a datetime variable using DHMS using your two variables and then subtract the two which would give me the difference in seconds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming SAS dates and time values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dhms(date1, 0, 0, time1) - dhms(date2, 0, 0, time2) as duration_seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Aug 2016 20:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290312#M60049</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-08T20:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL: Calculate the number of hours between two time variables with separate date variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290332#M60058</link>
      <description>&lt;P&gt;Thanks Reeza. This got me what I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dhms(event_end_date,0,0,(input(event_end_time, time.))) - dhms(event_begin_date,0,0,(input(event_begin_time, time.)))&lt;BR /&gt;format =time8. as duration,&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2016 21:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Calculate-the-number-of-hours-between-two-time/m-p/290332#M60058</guid>
      <dc:creator>ebills</dc:creator>
      <dc:date>2016-08-08T21:23:14Z</dc:date>
    </item>
  </channel>
</rss>

