<?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: Record Count Per Hour in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555917#M9731</link>
    <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, you have been super helpful-appreciate the knowledge sharing!</description>
    <pubDate>Fri, 03 May 2019 13:18:44 GMT</pubDate>
    <dc:creator>gbond21</dc:creator>
    <dc:date>2019-05-03T13:18:44Z</dc:date>
    <item>
      <title>Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555145#M9602</link>
      <description>&lt;P&gt;I'd like to calculate the number of patients currently within an Emergency Room by hour and I'm having trouble conceptualizing an efficient code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two time variables, 'Check In Time' and 'Release Time'. These date/time variables are obviously arbitrary and the 'release time' variable will come after the 'check in time variable'. So, I'm taking into consideration check in time and release time to figure out the counts per hour, not just check in time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example data looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lang-sql prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt; Patient_ID    &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Check In Time'&lt;/SPAN&gt;                 &lt;SPAN class="str"&gt;'Release Time'&lt;/SPAN&gt;
 &lt;SPAN class="lit"&gt;01&lt;/SPAN&gt;           &lt;SPAN class="lit"&gt;2015-08-01&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;02&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;49&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;         &lt;SPAN class="lit"&gt;2015-08-01&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;08&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;29&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;
 &lt;SPAN class="lit"&gt;02&lt;/SPAN&gt;           &lt;SPAN class="lit"&gt;2015-08-02&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;01&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;30&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;         &lt;SPAN class="lit"&gt;2015-08-02&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;14&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;29&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;
 &lt;SPAN class="lit"&gt;03&lt;/SPAN&gt;           &lt;SPAN class="lit"&gt;2015-08-02&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;21&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;30&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;         &lt;SPAN class="lit"&gt;2015-09-02&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;01&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;20&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;00&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like the output for a given day to look something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    Hour        Midnight   1am   2am   3am    4am.....
    # of Pts      34       56     89    23     29&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So for example, at 1am there were 56 patients currently in the ED -when considering both checkin and release times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My initial thought is to: 1) round the time variables 2) Write a code a code the looks something like this...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  data EDTimesl;
  set  EDDATA;
  if checkin = '1am' and release = '2am' then OneAMToTwoAM = 1;
  if checkin = '1am' and release = '3am' then OneAMToTwoAM = 1;
  if checkin = '1am' and release = '3am' then TwoAMToThreeAM = 1;
  ....
  run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This, however, gives me pause because I feel there is a more efficient method!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see there is a previous post that touches on this topic but I'm having trouble checking if that code is correct, as it applies to my data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/One-Record-Per-Hour-of-Day/td-p/262983" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/One-Record-Per-Hour-of-Day/td-p/262983&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 17:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555145#M9602</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-04-30T17:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555183#M9615</link>
      <description>&lt;P&gt;Please describe how you are "&amp;nbsp;considering both checkin and release times" when determining your count as it relates to any particular "hour".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your values are indeed SAS datetime values then you have to consider the continuous nature of time and I am not sure what you would actually intend by :&lt;/P&gt;
&lt;PRE&gt;if checkin = '1am' and release = '2am' then OneAMToTwoAM = 1;
&lt;/PRE&gt;
&lt;P&gt;What times of day would be counted in your '1am' or '2am' value?&lt;/P&gt;
&lt;P&gt;The functions INTNX or INTCK are used to build or count intervals of time but an idea of exactly what sort of comparisons you want are needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I don't see anything that comes close to addressing the date portion. What if the release is two days later? How would that affect your "count".&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 19:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555183#M9615</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-30T19:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555193#M9620</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Checkin and Release times are date/time variables and I would need to determine the time span within the two variables per record. The code I provided, is something I do not intend to use-I was just pointing it out because it's an option but not a sustainable option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to round times of day to the nears hour e.g. 1:20AM would equal 1am; 3:45PM would equal 4PM.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If release date is more than 48 hours I would count that data as missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 19:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555193#M9620</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-04-30T19:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555201#M9623</link>
      <description>&lt;P&gt;SAS date and times are numeric, time is stored as # of seconds, dates as # of days. So you can use the floor function to get each date/time point to be for a specific hour using some basic math operations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;You still need to create a record for each hour or you can loop through and do the calculation iteratively, updating an array for example. Do you care about the date portion? Or do you only need hours of the day, in general.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your three record data set there please show the exact output you're expecting.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248453"&gt;@gbond21&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Checkin and Release times are date/time variables and I would need to determine the time span within the two variables per record. The code I provided, is something I do not intend to use-I was just pointing it out because it's an option but not a sustainable option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to round times of day to the nears hour e.g. 1:20AM would equal 1am; 3:45PM would equal 4PM.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If release date is more than 48 hours I would count that data as missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 20:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555201#M9623</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-30T20:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555205#M9626</link>
      <description>&lt;P&gt;Hi Reeza,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only hours of the day; however it would be useful to aggregate the data by day of the week. Id also like to be able to query by date, so for example if I have a data set for 2019-add a if statement that would would only contain dates in specific months.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greg&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The exact output would look like this if making a table by day is possible. It would show the number of patients currently in the ED by hour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hour&amp;nbsp; &amp;nbsp; &amp;nbsp; Monday&amp;nbsp; &amp;nbsp; Tuesday&amp;nbsp; &amp;nbsp;Wednesday ....&lt;/P&gt;&lt;P&gt;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 345&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;490&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;342&lt;/P&gt;&lt;P&gt;1am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;245&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;250&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;362&lt;/P&gt;&lt;P&gt;2am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;146&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;680&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;742&lt;/P&gt;&lt;P&gt;3am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;375&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;241&lt;/P&gt;&lt;P&gt;4am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;348&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;250&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;347&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 20:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555205#M9626</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-04-30T20:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555208#M9627</link>
      <description>How big is your original data set?</description>
      <pubDate>Tue, 30 Apr 2019 20:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555208#M9627</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-30T20:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555211#M9629</link>
      <description>&lt;P&gt;I have roughly 80,000 records within the dataset, thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 20:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555211#M9629</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-04-30T20:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555230#M9636</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248453"&gt;@gbond21&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only hours of the day; however it would be useful to aggregate the data by day of the week. Id also like to be able to query by date, so for example if I have a data set for 2019-add a if statement that would would only contain dates in specific months.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greg&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The exact output would look like this if making a table by day is possible. It would show the number of patients currently in the ED by hour.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hour&amp;nbsp; &amp;nbsp; &amp;nbsp; Monday&amp;nbsp; &amp;nbsp; Tuesday&amp;nbsp; &amp;nbsp;Wednesday ....&lt;/P&gt;
&lt;P&gt;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 345&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;490&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;342&lt;/P&gt;
&lt;P&gt;1am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;245&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;250&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;362&lt;/P&gt;
&lt;P&gt;2am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;146&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;680&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;742&lt;/P&gt;
&lt;P&gt;3am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;375&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;241&lt;/P&gt;
&lt;P&gt;4am&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;348&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;250&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;347&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;data example;
   input x datetime19.;
   format x datetime19.;
   /* round to hour: 3600 seconds*/
   y= round(x,3600);
   format y datetime19.;
datalines;
21APR2019:12:25:15
21APR2019:12:30:15
21APR2019:12:00:00
21APR2019:23:45:10
;
run;

proc freq data=example;
   table x y;
   format x dtwkdatx9. y timeampm5.;
run;
&lt;/PRE&gt;
&lt;P&gt;Formats will actually round values as well but I am still not sure if I understand all you needs. Choice of format for display is very flexible with date, time and datetime values. Plus you can usually role your own with at custom Picture format.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 22:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555230#M9636</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-30T22:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555256#M9648</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are two time variables checkin and release. For example, a patient checks in in at 10am and leaves at 4pm. So that patient would be counted at 10am, 11am, noon, 1pm, 2pm, and 3pm. I am not looking just at registered visits, rather the entirety of a patients stay.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 00:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555256#M9648</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-01T00:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555372#M9661</link>
      <description>Then the code in the link is correct for what you're trying to do here.</description>
      <pubDate>Wed, 01 May 2019 14:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555372#M9661</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-01T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555375#M9663</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248453"&gt;@gbond21&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two time variables checkin and release. For example, a patient checks in in at 10am and leaves at 4pm. So that patient would be counted at 10am, 11am, noon, 1pm, 2pm, and 3pm. I am not looking just at registered visits, rather the entirety of a patients stay.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Quite a different bit of information that was missing in your original problem description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
   informat patient_id $2. checkintime releasetime datetime18.;
   format checkintime releasetime datetime18.;
   input patient_id checkintime releasetime   ;
datalines;
01 01AUG2015:02:49:00        01AUG2015:08:29:00
02 01AUG2015:01:30:00        02AUG2015:14:29:00
03 02AUG2015:21:30:00        02SEP2015:01:20:00
;
run;

data want;
   set have;
   counttime = round(checkintime,3600);
   format counttime datetime18.;
   do while (counttime le round(releasetime,3600) );
      hr = timepart(counttime);
      day = weekday(datepart(counttime));
      output;
      counttime= intnx('hour',counttime,1,'B');
   end;
run;


proc tabulate data=want;
   class hr day;
   format hr timeampm5.;
   table hr='', day*n=''
         / box=hr
   ;
   label hr='Hour'
         day= 'Day of week'
   ;
run;


&lt;/PRE&gt;
&lt;P&gt;There is no "hour 0" basically that is midnight or 12AM.&lt;/P&gt;
&lt;P&gt;This shows the weekday number , 1= Sunday. You could use a custom format to show words.&lt;/P&gt;
&lt;P&gt;Or we could play some games with date functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;time values you showed&amp;nbsp;are not in&amp;nbsp;a standard SAS datetime format so I have to assume that the pasted values were from some other program.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 15:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555375#M9663</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-01T15:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555405#M9671</link>
      <description>&lt;P&gt;Thanks again. Sorry in advance for my lack of understanding but...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run that code, the output doesn't necessarily align with the data. For example, there is only one record which covers 12 AM; however, the output shows that there were 5 records on day 1-4 which had data for 12AM:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 241px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29150i24EA2A8721332BB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 16:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555405#M9671</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-01T16:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555410#M9672</link>
      <description>Please provide sample data for us where that occurs.</description>
      <pubDate>Wed, 01 May 2019 16:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555410#M9672</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-01T16:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555412#M9673</link>
      <description>&lt;P&gt;NVM disregard that response, I did not see one of the release dates was in September!&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555412#M9673</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-01T17:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555600#M9702</link>
      <description>&lt;P&gt;This code worked beautifully, thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next question would be how to adapt this to show averages. For example, if I ran this code for April 2019, I would like to know on average, how many patients were in the ED at 12am on Monday's, Tuesday's etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 13:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555600#M9702</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-02T13:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555624#M9705</link>
      <description>Use PROC MEANS on the resulting table with day/week/hour as your class or by variables.</description>
      <pubDate>Thu, 02 May 2019 14:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555624#M9705</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-02T14:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555917#M9731</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, you have been super helpful-appreciate the knowledge sharing!</description>
      <pubDate>Fri, 03 May 2019 13:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555917#M9731</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-03T13:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count Per Hour</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555988#M9743</link>
      <description>Hi Ball, quick question for you-in the code above what is the purpose of "day*n='' ? Thanks!</description>
      <pubDate>Fri, 03 May 2019 15:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Record-Count-Per-Hour/m-p/555988#M9743</guid>
      <dc:creator>gbond21</dc:creator>
      <dc:date>2019-05-03T15:53:31Z</dc:date>
    </item>
  </channel>
</rss>

