<?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: Visit Hour Per of ED Visit? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212916#M52565</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Okay, I've got it and it works as I wanted. I used the loop_end_dt version and then used that as the end date in my "data want" data set i.e. do date_hour=adm_date to loop_end_dt by 3600.&amp;nbsp; Thanks to you both. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Mar 2015 19:15:39 GMT</pubDate>
    <dc:creator>shellp55</dc:creator>
    <dc:date>2015-03-31T19:15:39Z</dc:date>
    <item>
      <title>Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212908#M52557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Previously I had asked SAS Communities how to create a data set so that I had one line of data per day of an inpatient visit and Reeza kindly provided the code below: data want; set have; do date=admit_date to discharge_date; output; end; run; proc freq data=want; table have; run; What I would like to do now is the same sort of thing but for ED visits and I'd like a line of data per HOUR of the visit.&amp;nbsp; So if the patient was in the ED from noon to 5:00 I'd like one line of data each for the hours of 12, 13, 14, 15, 16, and 17.&amp;nbsp; Any assistance greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 19:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212908#M52557</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2015-03-30T19:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212909#M52558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Same idea but change your do loop to have a record for each hour, assuming you have date time variables that represent the date/time of the visit and using the fact that 60 seconds * 60 minutes = 3600 seconds/hour&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set have; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;do date_hour=admit_datetime to discharge_datetime by 3600; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;output; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;end; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;r&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; font-size: 10pt; line-height: 1.5em;"&gt;un;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt; proc &lt;/SPAN&gt;&lt;SPAN style="line-height: 19.5px;"&gt;freq on date_hour. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 19:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212909#M52558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-30T19:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212910#M52559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are amazing, Reeza, thanks so much.&amp;nbsp; One more question:&amp;nbsp; how do I format the date_hour to be 01, 02 to 2300?&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 21:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212910#M52559</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2015-03-30T21:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212911#M52560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May as well get the hour out using hour and timepart function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hour(timepart(date_hour))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 21:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212911#M52560</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-30T21:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212912#M52561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Reeza, I just checked some of the data and I'm not sure it's working as I expected.&amp;nbsp; For instance, a chart with an admit date of 02Apr14:04:41:00 and a disposition date of 02Apr14:15:10:00 should have visits for hours 04 to 15 but only has from 04 to 14 in the database.&amp;nbsp; Why would it not also include 15? It seems to be prevalent in the resulting dataset that the end hour is not included.&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 21:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212912#M52561</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2015-03-30T21:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212913#M52562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll probably need to increment the disposition date for the loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have time to test it now, but you can try something like the following to change the end date. &lt;/P&gt;&lt;P&gt;Another option is to change the loop to a do while loop and use the intnx function to increment the time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both untested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date=admit_date;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do while(date&amp;lt;disposition_date);&lt;/P&gt;&lt;P&gt;date=intnx('hour', date, 1);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop_end_dt=round(disposition_date+1800, 3600);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 22:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212913#M52562</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-30T22:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212914#M52563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And a second bit depending on how and where your create and compare the end value: MINUTES&lt;/P&gt;&lt;P&gt;If you increment the admit date/time of 02Apr14:04:41:00 by two hours (02Apr14:06:41:00) and compare to a disposition datetime of 02Apr14:06:10:00 then you might be terminating your loop early using&lt;/P&gt;&lt;P&gt;do while(date&amp;lt;disposition_date); because the date skips over the disposition data and the dependent statements (such as OUTPUT) are not executed for the 06:41:00 value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to get a comparison value for your base comparison admit date to drop minutes before looping. and I think you may want le instead of &amp;lt; .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2015 23:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212914#M52563</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-30T23:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212915#M52564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thanks to you both...but ballardw I'm not sure what you mean.&amp;nbsp; What would you change in Reeza's code?&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2015 19:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212915#M52564</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2015-03-31T19:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Visit Hour Per of ED Visit?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212916#M52565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Okay, I've got it and it works as I wanted. I used the loop_end_dt version and then used that as the end date in my "data want" data set i.e. do date_hour=adm_date to loop_end_dt by 3600.&amp;nbsp; Thanks to you both. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2015 19:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Visit-Hour-Per-of-ED-Visit/m-p/212916#M52565</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2015-03-31T19:15:39Z</dc:date>
    </item>
  </channel>
</rss>

