<?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: Calculating missing time in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180333#M45957</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the first two columns what your data looks like or does your colour coding indicate something about the data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 16:25:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-02-24T16:25:56Z</dc:date>
    <item>
      <title>Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180332#M45956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have data from medical providers that documents the time they recorded temperatures in their vaccine storage units. They are supposed to record temps 24 hrs a day to make sure their refrigerators and freezers maintain appropriate temps so vaccines are not compromised. I know things happen where they may forget to plug their digital thermometers back after reading recordings or maybe have power failures...so they have a little leeway so 24 hours or more of missing recording time not good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the syntax to determine how much time is missing between a provider's storage unit record times?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Date/Time Start&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Date/Time End&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Missing Time (New Variable)&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;9/27/13 9:15&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;9/28/13 &lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;12:00&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt; ------&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;9/28/13 &lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;12:15&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG style="color: #ff6600;"&gt;9/28/13&lt;/STRONG&gt; &lt;SPAN style="color: #ff6600;"&gt;&lt;STRONG&gt;13:15&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Time from the end of their recording time to when they started recording again...14 minutes the provider didn't record&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #ff6600;"&gt;9/29/13&lt;/SPAN&gt; &lt;SPAN style="color: #ff6600;"&gt;15:15&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;9/30/13 11:30&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;26 hours the provider did not record temperatures&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 16:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180332#M45956</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T16:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180333#M45957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the first two columns what your data looks like or does your colour coding indicate something about the data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 16:25:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180333#M45957</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T16:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180334#M45958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, Reeza. I was just trying to make it clear what was being used to calculate the missing time. The coloring truly doesn't mean anything. Sorry for the confusion. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 16:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180334#M45958</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T16:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180335#M45959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The duration for the second record is 1 hour. Where does 14 minutes come from?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 16:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180335#M45959</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T16:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180336#M45960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How is this different than your other thread?&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/thread/71757"&gt;https://communities.sas.com/thread/71757&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How could anyone or anything determine "missing time" from the information provided?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180336#M45960</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-02-24T18:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180337#M45961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paige - these are two seperate questions. The first one that you helped me on, I needed to calculate total record time (duration) from the start/end times provided. This question, however, is asking how to figure out the time in between each recording. So, for example, the first line shows the doctor measure temps for a little over 26 hours. He unplugged his digital thermometer and didn't hook it back up until 12:15 on 9/28/13 (the second line)....14 minutes later (stopped recording at 12:00, began recording again at 12:15...14 minutes that are not accounted for). I can't figure out what SAS code to use that will calculate the missing time from one line to the next. Hope that makes sense! &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; From your comment above, if there isn't a way to determine missing time from the information provided, then that is good to know, as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180337#M45961</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T18:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180338#M45962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza - The 14 minutes is the difference in time from the 1st line's ending and the 2nd line's start time. This doctor unplugged his thermometer/ended recording at 12:00 on 9/28/13 (END time for the first line). He started recording again at 12:15 on 9/28/13 (second line's START time). There was 14 minutes that he did have temperature data because his thermometer was not recording. Hope that makes sense. Thanks so much for your thoughts. I feel like pulling my hair out. Ahhh!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180338#M45962</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T18:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180339#M45963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I get it, so you want to subtract the end time on line 1 from the start time on line 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same method works as in the other thread, once you have taken care of the issue that the data isn't on the same line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like this (assuming these are actual datetime values)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_end_time=lag(end_time);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; missing_time=start_time - prev_end_time;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format missing_time time.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180339#M45963</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-02-24T18:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180340#M45964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANK YOU SOOOOO much, Paige. Yes...you understood my lengthy explanation correctly. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'm going to try this now. Thank you!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180340#M45964</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T18:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180341#M45965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the lag function, see the code below. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Then use if/then calculations based on that variable. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that the duration from 00 to 15 is 15 minutes, if you need 14 minutes as you've indicated you'll need to use a correction factor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your variables are SAS Datetime variables, time_unplugged, will be noted in seconds and you'll need to convert that to minutes/hours as required or use the hhmm format applied. Otherwise, as indicated in your other questions you'll need to convert it to a SAS datetime. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; have;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;informat&lt;/SPAN&gt; time_start time_end &lt;SPAN style="color: #009193;"&gt;datetime20.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #009193;"&gt;&lt;SPAN style="color: #0433ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; time_: &lt;/SPAN&gt;datetime21.&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;input&lt;/SPAN&gt; time_start time_end;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;27SEP13:09:15:00 28SEP13:12:00:00&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;28SEP13:12:15:00 28SEP13:13:15:00&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;29SEP13:15:15:00 30SEP13:11:30:00&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; want;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;set&lt;/SPAN&gt; have;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;time_unplugged=time_start-lag(time_end);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;format&lt;/SPAN&gt; time_unplugged &lt;SPAN style="color: #009193;"&gt;hhmm7.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0433ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;=want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180341#M45965</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T18:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating missing time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180342#M45966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much, Reeza!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 18:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-missing-time/m-p/180342#M45966</guid>
      <dc:creator>ebonyw</dc:creator>
      <dc:date>2015-02-24T18:57:43Z</dc:date>
    </item>
  </channel>
</rss>

