<?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: Time Difference between Different Records in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110867#M9472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATETIMEs in SAS are stored as an integer number of seconds since 1/1/1960 0:00:00.&amp;nbsp; So, you can simply subtract the two values.&amp;nbsp; You can then format the result with a TIME format.&lt;/P&gt;&lt;PRE&gt;Data want;
set have;
by appID;
retain starting_time;
if first.appID then starting_time=starttime;
if last.appID then do;
duration=endtime-starting_time;
output;
end;
format duration TIME8.;
run;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Oct 2013 20:27:29 GMT</pubDate>
    <dc:creator>snoopy369</dc:creator>
    <dc:date>2013-10-11T20:27:29Z</dc:date>
    <item>
      <title>Time Difference between Different Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110866#M9471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is resultant table with just the first and last records for each application.&amp;nbsp; How can I get the time difference between the first record (Start Time) and the last record (EndTime) for the same application id?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example - AppID 1001 time difference is 0 hours, 2 minutes, 24 seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="540"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="113"&gt;AppID&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="73"&gt;OprID&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="177"&gt;StartTime&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="177"&gt;EndTime&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl71" height="20" style="border-top: none;"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl72" style="border-top: none; border-left: none;"&gt;09OCT2013:11:24:51.000000&lt;/TD&gt;&lt;TD class="xl72" style="border-top: none; border-left: none;"&gt;09OCT2013:11:27:15.000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl71" height="20" style="border-top: none;"&gt;1001&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl72" style="border-top: none; border-left: none;"&gt;09OCT2013:11:26:16.000000&lt;/TD&gt;&lt;TD class="xl72" style="border-top: none; border-left: none;"&gt;09OCT2013:11:27:15.000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20" style="border-top: none;"&gt;1002&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;09OCT2013:09:15:49.000000&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;09OCT2013:09:34:33.000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20" style="border-top: none;"&gt;1002&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;09OCT2013:09:24:16.000000&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;09OCT2013:09:34:33.000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl69" height="20" style="border-top: none;"&gt;1003&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl70" style="border-top: none; border-left: none;"&gt;09OCT2013:11:19:43.000000&lt;/TD&gt;&lt;TD class="xl70" style="border-top: none; border-left: none;"&gt;09OCT2013:11:19:57.000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl69" height="20" style="border-top: none;"&gt;1003&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl70" style="border-top: none; border-left: none;"&gt;10OCT2013:14:50:47.000000&lt;/TD&gt;&lt;TD class="xl70" style="border-top: none; border-left: none;"&gt;10OCT2013:14:51:16.000000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110866#M9471</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2013-10-11T20:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference between Different Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110867#M9472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATETIMEs in SAS are stored as an integer number of seconds since 1/1/1960 0:00:00.&amp;nbsp; So, you can simply subtract the two values.&amp;nbsp; You can then format the result with a TIME format.&lt;/P&gt;&lt;PRE&gt;Data want;
set have;
by appID;
retain starting_time;
if first.appID then starting_time=starttime;
if last.appID then do;
duration=endtime-starting_time;
output;
end;
format duration TIME8.;
run;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110867#M9472</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-11T20:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference between Different Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110868#M9473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Snoopy369!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 20:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Time-Difference-between-Different-Records/m-p/110868#M9473</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2013-10-11T20:40:34Z</dc:date>
    </item>
  </channel>
</rss>

