<?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: How can I determine if midnight is included in the last day of a pateint's stay in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688918#M209376</link>
    <description>&lt;P&gt;How does one determine "&lt;SPAN&gt;the patient's last day in the intensive care unit crossed midnight"? I am not clear on this. However:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cross_midnight = intck('dtday',istart,istop,'d')&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Shouldn't row 2 have cross_midnight=Y ??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, it is really helpful if you provide your example data as &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;SAS DATA step code&lt;/A&gt;, and not as a screen capture, so we can actually test our sample code on your actual data. Please do that from now on.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2020 16:11:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-10-05T16:11:08Z</dc:date>
    <item>
      <title>How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688917#M209375</link>
      <description>&lt;P&gt;I have patients admitted to an intensive care unit., their start datetime (istart) and their discharge datetime (istop). I need to know if the patient's last day in the intensive care unit crossed midnight. Below are some samples datetimes. Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;istart&lt;/TD&gt;&lt;TD&gt;istop&lt;/TD&gt;&lt;TD&gt;Cross_Midnight&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2020 13:00:00&lt;/TD&gt;&lt;TD&gt;01/03/2020&amp;nbsp; 1:00:00&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2020 13:00:00&lt;/TD&gt;&lt;TD&gt;01/03/2020 23:00:00&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2020&amp;nbsp; 1:00:00&lt;/TD&gt;&lt;TD&gt;01/01/2020 23:50:00&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2020 1:00:00&lt;/TD&gt;&lt;TD&gt;01/02/2020&amp;nbsp; 2:00&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688917#M209375</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2020-10-05T16:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688918#M209376</link>
      <description>&lt;P&gt;How does one determine "&lt;SPAN&gt;the patient's last day in the intensive care unit crossed midnight"? I am not clear on this. However:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cross_midnight = intck('dtday',istart,istop,'d')&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Shouldn't row 2 have cross_midnight=Y ??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, it is really helpful if you provide your example data as &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;SAS DATA step code&lt;/A&gt;, and not as a screen capture, so we can actually test our sample code on your actual data. Please do that from now on.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688918#M209376</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-05T16:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688919#M209377</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if intck('dtday',istart,istop) &amp;gt; 0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if datepart(istop) &amp;gt; datepart(istart)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688919#M209377</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-05T16:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688927#M209381</link>
      <description>I didn't explain it clearly. What I didn't put in my post was the length of stay: 1.500 for the first patient above, then 2.500, 0.951, and 1.042. What I wanted to do is to see if the fractional part of the length of stay crossed midnight. Did the 0.500 part of a day include midnight, .0.500, 0.951, 0.042.?</description>
      <pubDate>Mon, 05 Oct 2020 16:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688927#M209381</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2020-10-05T16:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688931#M209382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83350"&gt;@DocMartin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I didn't explain it clearly. What I didn't put in my post was the length of stay: 1.500 for the first patient above, then 2.500, 0.951, and 1.042. What I wanted to do is to see if the fractional part of the length of stay crossed midnight. Did the 0.500 part of a day include midnight, .0.500, 0.951, 0.042.?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How can a fractional part include midnight? Do you mean the istop time compared to the difference (istop time minus the fractional part) includes midnight?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688931#M209382</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-05T16:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688940#M209386</link>
      <description>&lt;P&gt;Here's the SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data icu; input istart datetime16. istop datetime16.;
cards;
01Jan20:13:00:00    03Jan20:01:00:00	 
01Jan20:13:00:00	03Jan20:23:00:00	 	
01Jan20:01:00:00	01Jan20:23:50:00	
01Jan20:01:00:00	02Jan20:02:00 
;

data icu1; set icu;
  format istart istop datetime16.;
  iculos = (istop - istart)/86400;
  put istart istop iculos;
run;

01JAN20:13:00:00 03JAN20:01:00:00 1.5
01JAN20:13:00:00 03JAN20:23:00:00 2.4166666667
01JAN20:01:00:00 01JAN20:23:05:00 0.9201388889
01JAN20:01:00:00 02JAN20:02:00:00 1.0416666667&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688940#M209386</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2020-10-05T16:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688954#M209394</link>
      <description>Yikes, I figured it out for myself. I was making things too hard. All I had to do was:&lt;BR /&gt;if timepart(istart) &amp;gt; timepart(istop) then midnight = 'Y'; else midnight = 'N';</description>
      <pubDate>Mon, 05 Oct 2020 17:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688954#M209394</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2020-10-05T17:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I determine if midnight is included in the last day of a pateint's stay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688955#M209395</link>
      <description>&lt;P&gt;But this doesn't work if the stay in the ICU is greater than 24 hours (or does it)? How would this work on your row 2?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 17:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-determine-if-midnight-is-included-in-the-last-day-of-a/m-p/688955#M209395</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-05T17:31:55Z</dc:date>
    </item>
  </channel>
</rss>

