Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create observations for each hour of a duration

    Hi all,

    Below is my code, there are a few problems with it. I would appreciate any advice! I am new to STATA (this is my first project!)

    Overall, I am trying to show hospital arrivals (num_edtc) and discharges (num_dcord) during each hour of a physician's shift. Each physician is represented by phys_name and the shift start/end date/time is num_shift_start1 and num_shift_end1, respectively. Here is what I am struggling with:
    1. The code is counting the number of hours within a shift and expanding the dataset by those hours, however the start/end time for their shift is not being broken down within that. Ex: A physician works for 9 hours, there are now 9 observations for an initial 1. The start and end times are the same as the initial observation, rather than counting by an hour each.
      1. I have tried adding num_shift_start1 + 3,600,000 * (admit_id - 1)
      2. I think I could create a loop where I add 3,600,000 each time and loop for the number of hours, I'm not sure how to update the start/end times in the dataset with this. Is there a less clunky way?
    2. Towards the end, it is showing the sum of all patients in the hospital, rather than the patients who were assigned to a particular physician. I tried to resolve this via bysort. If my problem above is solved, I think I can run a conditional to check for a patient and create a dummy variable.
    3. If there is a simpler way to approach this, I am open to suggestions!

    Code:
    import excel "/Users/amandabuechele/Desktop/RA Test 2022/#3.xls", sheet("#3") firstrow allstring
    
    ***Combine shift start/end date/time
    **# Bookmark #1
    generate shift_start = shiftstart_date + " " + shiftstart_time
    gen shiftend_date = shfitend_date
    generate shift_end = shiftend_date + " " + shiftend_time
    
    ***Convert string date/time variables to numeric
    generate double num_edtc = clock(edtc, "MDYhm")
    generate double num_dcord = clock(dcord_tc, "MDYhm")
    gen double num_shift_start1 = clock(shift_start, "DM19Yhms")
    gen double num_shift_end1 = clock(shift_end, "DM19Yhms")
    
    format %tcMonth_dd,_CCYY_HH:MM:SS num_edtc
    format %tcMonth_dd,_CCYY_HH:MM:SS num_dcord
    format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_start1
    format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_end1
    
    
    
    ***Create admission ID
    gen admit_id = _n
    
    ***Create hourly dataset PROBLEM IS COUNTING HOURS AND EXPANDING BY HOURS BUT NOT REPLACING START/END
    gen hours = cond(hh(num_shift_start1) < hh(num_shift_end1), hh(num_shift_end1) - hh(num_shift_start1), hh(24 - (num_shift_start1)) +  hh(num_shift_end1))
    expand hours
    sort phys_name num_shift_start1 num_shift_end1
    
    
    *** PROBLEM IS NOT BREAKING DOWN SHIFT HOUR BY HOUR
    bysort phys_name admit_id (num_shift_start1 num_shift_end1): gen double start = num_shift_start1  
    format %tcMonth_dd,_CCYY_HH:MM:SS start
    bysort phys_name admit_id (num_shift_start1 num_shift_end1): gen double end = num_shift_end1
    format %tcMonth_dd,_CCYY_HH:MM:SS end
    format start end %tc
    drop num_shift_start1 num_shift_end1 
    
    
    ***Check if patient is in hospital 
    bysort phys_name: gen in_hospital = (num_edtc <= start & num_dcord <= end) | (num_edtc >= start & num_edtc <= end) | (num_edtc <= start & num_dcord >= end)
    
    ***Sum patients per hour in hospital PROBLEM IS SUM OF ALL PATIENTS IN HOSPITAL NOT BY PHYSICIAN
    collapse (sum) in_hospital, by(phys_name start end)
    list, sepby(phys_name)

  • #2
    Start by providing a data example, e.g., by copying and pasting the result of:

    Code:
    import excel "/Users/amandabuechele/Desktop/RA Test 2022/#3.xls", sheet("#3") firstrow allstring clear
    dataex phys_name admit_id shiftstart_date shiftstart_time shiftend_date shiftend_time

    If you cannot share the data for confidentiality reasons, see what is recommended in FAQ Advice #12.
    Last edited by Andrew Musau; 27 Apr 2022, 16:06.

    Comment


    • #3
      Sorry about that! Here is the sample.

      Code:
      input str10 phys_name float admit_id double(num_shift_start1 num_shift_end1 num_edtc num_dcord)
      "Andrew"   1 7.061076e+11   7.0614e+11 706070820000 706186140000
      "Andrew"   2 7.111188e+11 7.111512e+11 711092940000 7.110966e+11
      "Andrew"   3  7.09902e+11 7.099344e+11 709866060000 709870140000
      "Andrew"   4  7.06428e+11  7.06464e+11 706445460000 706529460000
      "Andrew"   5  7.06428e+11  7.06464e+11 706436280000 706438920000
      "Andrew"   6 7.103916e+11  7.10424e+11 710396040000 7.103997e+11
      "Andrew"   7 7.101684e+11 7.102008e+11 710138580000 710141940000
      "Andrew"   8  7.09902e+11 7.099344e+11 709907640000 709877640000
      "Andrew"   9 7.072128e+11 7.072452e+11 707213520000   7.0719e+11
      "Andrew"  10 7.101684e+11 7.102008e+11 710137980000 7.101483e+11
      "Andrew"  11 7.097868e+11 7.098192e+11 709783620000 709799520000
      "Andrew"  12 7.068852e+11 7.069176e+11 706851240000 706866180000
      "Andrew"  13 7.086816e+11  7.08714e+11 708686160000 708688860000
      "Andrew"  14  7.09902e+11 7.099344e+11 709872660000 709887420000
      "Andrew"  15 7.063596e+11  7.06392e+11 706363620000 706335540000
      "Andrew"  16 7.072128e+11 7.072452e+11 707191320000 707207160000
      "Andrew"  17  7.09902e+11 7.099344e+11 709879560000 709888440000
      "Andrew"  18 7.072848e+11 7.073172e+11 707305140000 707316420000
      Last edited by Amanda Buechele; 27 Apr 2022, 16:18.

      Comment


      • #4
        In your example, your physicians work round hours. See

        Code:
        help mod()
        to define a condition for the hours if this is not necessarily the case.

        Code:
        clear
        input str10 phys_name float admit_id str9 shiftstart_date str8 shiftstart_time str9(shiftend_date shiftend_time) double(num_edtc num_dcord)
        "Andrew"   1 "17-May-82" "13:00:00" "17-May-82" " 22:00:00" 706070820000 706186140000
        "Andrew"   2 "14-Jul-82" "13:00:00" "14-Jul-82" " 22:00:00" 711092940000 7.110966e+11
        "Andrew"   3 "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00" 709866060000 709870140000
        "Andrew"   4 "21-May-82" "06:00:00" "21-May-82" " 16:00:00" 706445460000 706529460000
        "Andrew"   5 "21-May-82" "06:00:00" "21-May-82" " 16:00:00" 706436280000 706438920000
        "Andrew"   6 " 6-Jul-82" "03:00:00" " 6-Jul-82" " 12:00:00" 710396040000 7.103997e+11
        "Andrew"   7 " 3-Jul-82" "13:00:00" " 3-Jul-82" " 22:00:00" 710138580000 710141940000
        "Andrew"   8 "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00" 709907640000 709877640000
        end
        
        gen double start= clock(trim(shiftstart_date)+"-"+trim(shiftstart_time), "DM19Yhms")
        gen double end= clock(trim(shiftend_date)+"-"+trim(shiftend_time), "DM19Yhms")
        gen double diff = int((end-start)/(1000*60*60))
        expand diff
        bys phys_name admit_id: replace start= start[_n-1]+(1000*60*60) if _n>1
        bys phys_name admit_id: replace end= start+ (1000*60*60)
        format num_* start end %tc
        Res.:

        Code:
        
        . l phys_name admit_id shiftstart_date shiftstart_time shiftend_date shiftend_time start end diff, sepby(phys_name admit_id)
        
             +---------------------------------------------------------------------------------------------------------------------+
             | phys_n~e   admit_id   shifts~te   s~t_time   shifte~te   shifte~me                start                  end   diff |
             |---------------------------------------------------------------------------------------------------------------------|
          1. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 13:00:00   17may1982 14:00:00      9 |
          2. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 14:00:00   17may1982 15:00:00      9 |
          3. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 15:00:00   17may1982 16:00:00      9 |
          4. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 16:00:00   17may1982 17:00:00      9 |
          5. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 17:00:00   17may1982 18:00:00      9 |
          6. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 18:00:00   17may1982 19:00:00      9 |
          7. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 19:00:00   17may1982 20:00:00      9 |
          8. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 20:00:00   17may1982 21:00:00      9 |
          9. |   Andrew          1   17-May-82   13:00:00   17-May-82    22:00:00   17may1982 21:00:00   17may1982 22:00:00      9 |
             |---------------------------------------------------------------------------------------------------------------------|
         10. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 13:00:00   14jul1982 14:00:00      9 |
         11. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 14:00:00   14jul1982 15:00:00      9 |
         12. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 15:00:00   14jul1982 16:00:00      9 |
         13. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 16:00:00   14jul1982 17:00:00      9 |
         14. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 17:00:00   14jul1982 18:00:00      9 |
         15. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 18:00:00   14jul1982 19:00:00      9 |
         16. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 19:00:00   14jul1982 20:00:00      9 |
         17. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 20:00:00   14jul1982 21:00:00      9 |
         18. |   Andrew          2   14-Jul-82   13:00:00   14-Jul-82    22:00:00   14jul1982 21:00:00   14jul1982 22:00:00      9 |
             |---------------------------------------------------------------------------------------------------------------------|
         19. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 11:00:00   30jun1982 12:00:00      9 |
         20. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 12:00:00   30jun1982 13:00:00      9 |
         21. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 13:00:00   30jun1982 14:00:00      9 |
         22. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 14:00:00   30jun1982 15:00:00      9 |
         23. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 15:00:00   30jun1982 16:00:00      9 |
         24. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 16:00:00   30jun1982 17:00:00      9 |
         25. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 17:00:00   30jun1982 18:00:00      9 |
         26. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 18:00:00   30jun1982 19:00:00      9 |
         27. |   Andrew          3   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 19:00:00   30jun1982 20:00:00      9 |
             |---------------------------------------------------------------------------------------------------------------------|
         28. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 06:00:00   21may1982 07:00:00     10 |
         29. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 07:00:00   21may1982 08:00:00     10 |
         30. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 08:00:00   21may1982 09:00:00     10 |
         31. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 09:00:00   21may1982 10:00:00     10 |
         32. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 10:00:00   21may1982 11:00:00     10 |
         33. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 11:00:00   21may1982 12:00:00     10 |
         34. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 12:00:00   21may1982 13:00:00     10 |
         35. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 13:00:00   21may1982 14:00:00     10 |
         36. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 14:00:00   21may1982 15:00:00     10 |
         37. |   Andrew          4   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 15:00:00   21may1982 16:00:00     10 |
             |---------------------------------------------------------------------------------------------------------------------|
         38. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 06:00:00   21may1982 07:00:00     10 |
         39. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 07:00:00   21may1982 08:00:00     10 |
         40. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 08:00:00   21may1982 09:00:00     10 |
         41. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 09:00:00   21may1982 10:00:00     10 |
         42. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 10:00:00   21may1982 11:00:00     10 |
         43. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 11:00:00   21may1982 12:00:00     10 |
         44. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 12:00:00   21may1982 13:00:00     10 |
         45. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 13:00:00   21may1982 14:00:00     10 |
         46. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 14:00:00   21may1982 15:00:00     10 |
         47. |   Andrew          5   21-May-82   06:00:00   21-May-82    16:00:00   21may1982 15:00:00   21may1982 16:00:00     10 |
             |---------------------------------------------------------------------------------------------------------------------|
         48. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 03:00:00   06jul1982 04:00:00      9 |
         49. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 04:00:00   06jul1982 05:00:00      9 |
         50. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 05:00:00   06jul1982 06:00:00      9 |
         51. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 06:00:00   06jul1982 07:00:00      9 |
         52. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 07:00:00   06jul1982 08:00:00      9 |
         53. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 08:00:00   06jul1982 09:00:00      9 |
         54. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 09:00:00   06jul1982 10:00:00      9 |
         55. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 10:00:00   06jul1982 11:00:00      9 |
         56. |   Andrew          6    6-Jul-82   03:00:00    6-Jul-82    12:00:00   06jul1982 11:00:00   06jul1982 12:00:00      9 |
             |---------------------------------------------------------------------------------------------------------------------|
         57. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 13:00:00   03jul1982 14:00:00      9 |
         58. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 14:00:00   03jul1982 15:00:00      9 |
         59. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 15:00:00   03jul1982 16:00:00      9 |
         60. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 16:00:00   03jul1982 17:00:00      9 |
         61. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 17:00:00   03jul1982 18:00:00      9 |
         62. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 18:00:00   03jul1982 19:00:00      9 |
         63. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 19:00:00   03jul1982 20:00:00      9 |
         64. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 20:00:00   03jul1982 21:00:00      9 |
         65. |   Andrew          7    3-Jul-82   13:00:00    3-Jul-82    22:00:00   03jul1982 21:00:00   03jul1982 22:00:00      9 |
             |---------------------------------------------------------------------------------------------------------------------|
         66. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 11:00:00   30jun1982 12:00:00      9 |
         67. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 12:00:00   30jun1982 13:00:00      9 |
         68. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 13:00:00   30jun1982 14:00:00      9 |
         69. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 14:00:00   30jun1982 15:00:00      9 |
         70. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 15:00:00   30jun1982 16:00:00      9 |
         71. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 16:00:00   30jun1982 17:00:00      9 |
         72. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 17:00:00   30jun1982 18:00:00      9 |
         73. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 18:00:00   30jun1982 19:00:00      9 |
         74. |   Andrew          8   30-Jun-82   11:00:00   30-Jun-82    20:00:00   30jun1982 19:00:00   30jun1982 20:00:00      9 |
             +---------------------------------------------------------------------------------------------------------------------+
        Last edited by Andrew Musau; 27 Apr 2022, 16:46.

        Comment


        • #5
          Thank you! This worked, I just had to add a few lines to differentiate between a patient being in the hospital, versus entry/discharge within a shift. Do you have any suggestions for a graph that would show a physician's day clearly?

          Comment


          • #6
            Assuming that you have a flow variable, e.g., admissions during each hour of the shift period, then you can opt for a line graph. Possibilities are xtline and fabplot from the Stata Journal. Here is an example using the latter.

            Code:
            clear
            input str10 phys_name float admit_id str9 shiftstart_date str8 shiftstart_time str9(shiftend_date shiftend_time) double(num_edtc num_dcord)
            "Andrew"   1 "17-May-82" "13:00:00" "17-May-82" " 22:00:00" 706070820000 706186140000
            "Andrew"   2 "14-Jul-82" "13:00:00" "14-Jul-82" " 22:00:00" 711092940000 7.110966e+11
            "Andrew"   3 "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00" 709866060000 709870140000
            "Andrew"   4 "21-May-82" "06:00:00" "21-May-82" " 16:00:00" 706445460000 706529460000
            "Andrew"   5 " 6-Jul-82" "03:00:00" " 6-Jul-82" " 12:00:00" 710396040000 7.103997e+11
            "Andrew"   6 " 3-Jul-82" "13:00:00" " 3-Jul-82" " 22:00:00" 710138580000 710141940000
            end
            
            gen double start= clock(trim(shiftstart_date)+"-"+trim(shiftstart_time), "DM19Yhms")
            gen double end= clock(trim(shiftend_date)+"-"+trim(shiftend_time), "DM19Yhms")
            gen double diff = int((end-start)/(1000*60*60))
            expand diff
            bys phys_name admit_id: replace start= start[_n-1]+(1000*60*60) if _n>1
            bys phys_name admit_id: replace end= start+ (1000*60*60)
            format num_* start end %tc
            set seed 04282022
            gen admissions= runiformint(0, 200)
            egen id= group(phys_name shiftstart_date shiftstart_time), label
            bys id (start): gen hour=_n
            set scheme s1color
            fabplot line admissions hour, by(id) xlab(1/9) xtitle("Hour") ytitle("No. of admissions")
            Click image for larger version

Name:	Graph.png
Views:	1
Size:	178.4 KB
ID:	1661963

            Comment


            • #7
              Thank you! Last query, I am working with a similar problem where I am breaking down each hour of a day. My ultimate goal is to reshape the data, so that each observation is an hour. I can do this, but my code for counting by hour and day is repeating throughout all observations, rather than for each visit; therefore, my reshaped data has dates that extend well beyond my dataset. For example, after counting by hour for the first case on May 15th, my work is then counting by hour for the second case on May 15th starting with May 16th. Any ideas on how to resolve? Below is an example (I believe it's easier to see the problem in the non-code dataset.

              Code:
              input float(num_shiftend_date date_id) double(day_start day_end)
              8170 1  7.05888e+11 7.058916e+11
              8170 1 7.058916e+11 7.058952e+11
              8170 1 7.058952e+11 7.058988e+11
              8170 1 7.058988e+11 7.059024e+11
              8170 1 7.059024e+11  7.05906e+11
              8170 1  7.05906e+11 7.059096e+11
              8170 1 7.059096e+11 7.059132e+11
              8170 1 7.059132e+11 7.059168e+11
              8170 1 7.059168e+11 7.059204e+11
              8170 1 7.059204e+11  7.05924e+11
              8170 1  7.05924e+11 7.059276e+11
              8170 1 7.059276e+11 7.059312e+11
              8170 1 7.059312e+11 7.059348e+11
              8170 1 7.059348e+11 7.059384e+11
              8170 1 7.059384e+11  7.05942e+11
              8170 1  7.05942e+11 7.059456e+11
              8170 1 7.059456e+11 7.059492e+11
              8170 1 7.059492e+11 7.059528e+11
              8170 1 7.059528e+11 7.059564e+11
              8170 1 7.059564e+11   7.0596e+11
              8170 1   7.0596e+11 7.059636e+11
              8170 1 7.059636e+11 7.059672e+11
              8170 1 7.059672e+11 7.059708e+11
              8170 1 7.059708e+11 7.059744e+11
              8170 1 7.059744e+11  7.05978e+11
              8170 1  7.05978e+11 7.059816e+11
              8170 1 7.059816e+11 7.059852e+11
              8170 1 7.059852e+11 7.059888e+11
              num_shiftend_date date_id day_start day_end
              May 15, 1982 1 May 15, 1982 00:00:00 May 15, 1982 01:00:00
              May 15, 1982 1 May 15, 1982 01:00:00 May 15, 1982 02:00:00
              May 15, 1982 1 May 15, 1982 02:00:00 May 15, 1982 03:00:00
              May 15, 1982 1 May 15, 1982 03:00:00 May 15, 1982 04:00:00
              May 15, 1982 1 May 15, 1982 04:00:00 May 15, 1982 05:00:00
              May 15, 1982 1 May 15, 1982 05:00:00 May 15, 1982 06:00:00
              May 15, 1982 1 May 15, 1982 06:00:00 May 15, 1982 07:00:00
              May 15, 1982 1 May 15, 1982 07:00:00 May 15, 1982 08:00:00
              May 15, 1982 1 May 15, 1982 08:00:00 May 15, 1982 09:00:00
              May 15, 1982 1 May 15, 1982 09:00:00 May 15, 1982 10:00:00
              May 15, 1982 1 May 15, 1982 10:00:00 May 15, 1982 11:00:00
              May 15, 1982 1 May 15, 1982 11:00:00 May 15, 1982 12:00:00
              May 15, 1982 1 May 15, 1982 12:00:00 May 15, 1982 13:00:00
              May 15, 1982 1 May 15, 1982 13:00:00 May 15, 1982 14:00:00
              May 15, 1982 1 May 15, 1982 14:00:00 May 15, 1982 15:00:00
              May 15, 1982 1 May 15, 1982 15:00:00 May 15, 1982 16:00:00
              May 15, 1982 1 May 15, 1982 16:00:00 May 15, 1982 17:00:00
              May 15, 1982 1 May 15, 1982 17:00:00 May 15, 1982 18:00:00
              May 15, 1982 1 May 15, 1982 18:00:00 May 15, 1982 19:00:00
              May 15, 1982 1 May 15, 1982 19:00:00 May 15, 1982 20:00:00
              May 15, 1982 1 May 15, 1982 20:00:00 May 15, 1982 21:00:00
              May 15, 1982 1 May 15, 1982 21:00:00 May 15, 1982 22:00:00
              May 15, 1982 1 May 15, 1982 22:00:00 May 15, 1982 23:00:00
              May 15, 1982 1 May 15, 1982 23:00:00 May 16, 1982 00:00:00
              May 15, 1982 1 May 16, 1982 00:00:00 May 16, 1982 01:00:00
              May 15, 1982 1 May 16, 1982 01:00:00 May 16, 1982 02:00:00
              May 15, 1982 1 May 16, 1982 02:00:00 May 16, 1982 03:00:00
              May 15, 1982 1 May 16, 1982 03:00:00 May 16, 1982 04:00:00

              I think if I had an index to uniquely ID all 24 observations hour by hour within each visit, then I could sort by that before counting by hour. Or I could create some type of loop. Regardless, here is the code that got me there:

              Code:
              ***Create admission ID 
              gen admit_id = _n
              
              ***Create index for each day
              gen num_shiftend_date = date(shiftend_date, "DM19Y")
              format %tdMonth_dd,_CCYY num_shiftend_date
              sort num_shiftend_date
              egen date_id = group(num_shiftend_date)
              
              
              ***Create day duration
              gen day_start_time = " "
              gen day_end_time = " "
              sort date_id
              by date_id: replace day_start_time = "00:00:00"
              by date_id: replace day_end_time = "23:59:00"
              
              ***Create hour by hour breakdown
              gen double day_start= clock(trim(shiftstart_date)+"-"+trim(day_start_time), "DM19Yhms")
              gen double day_end= clock(trim(shiftend_date)+"-"+trim(day_end_time), "DM19Yhms")
              gen double diff = int((day_end - day_start)/(1000*60*60))
              
              format %tcMonth_dd,_CCYY_HH:MM:SS day_start
              format %tcMonth_dd,_CCYY_HH:MM:SS day_end
              
              expand diff
              *** TROUBLE AREA
              bys date_id: replace day_start = day_start[_n-1]+(1000*60*60) if _n>1
              bys date_id: replace day_end = day_start+ (1000*60*60)

              Comment


              • #8
                How did you get here?

                Code:
                . l, sep(0)
                
                     +-------------------------------------------------------------------------+
                     | num_sh~e   date_id            day_start              day_end   admit_id |
                     |-------------------------------------------------------------------------|
                  1. |     8170         1   15may1982 00:00:00   15may1982 01:00:00          1 |
                  2. |     8170         1   15may1982 01:00:00   15may1982 02:00:00          2 |
                  3. |     8170         1   15may1982 02:00:00   15may1982 03:00:00          3 |
                  4. |     8170         1   15may1982 03:00:00   15may1982 04:00:00          4 |
                  5. |     8170         1   15may1982 04:00:00   15may1982 05:00:00          5 |
                  6. |     8170         1   15may1982 05:00:00   15may1982 06:00:00          6 |
                  7. |     8170         1   15may1982 06:00:00   15may1982 07:00:00          7 |
                  8. |     8170         1   15may1982 07:00:00   15may1982 08:00:00          8 |
                  9. |     8170         1   15may1982 08:00:00   15may1982 09:00:00          9 |
                 10. |     8170         1   15may1982 09:00:00   15may1982 10:00:00         10 |
                 11. |     8170         1   15may1982 10:00:00   15may1982 11:00:00         11 |
                 12. |     8170         1   15may1982 11:00:00   15may1982 12:00:00         12 |
                 13. |     8170         1   15may1982 12:00:00   15may1982 13:00:00         13 |
                 14. |     8170         1   15may1982 13:00:00   15may1982 14:00:00         14 |
                 15. |     8170         1   15may1982 14:00:00   15may1982 15:00:00         15 |
                 16. |     8170         1   15may1982 15:00:00   15may1982 16:00:00         16 |
                 17. |     8170         1   15may1982 16:00:00   15may1982 17:00:00         17 |
                 18. |     8170         1   15may1982 17:00:00   15may1982 18:00:00         18 |
                 19. |     8170         1   15may1982 18:00:00   15may1982 19:00:00         19 |
                 20. |     8170         1   15may1982 19:00:00   15may1982 20:00:00         20 |
                 21. |     8170         1   15may1982 20:00:00   15may1982 21:00:00         21 |
                 22. |     8170         1   15may1982 21:00:00   15may1982 22:00:00         22 |
                 23. |     8170         1   15may1982 22:00:00   15may1982 23:00:00         23 |
                 24. |     8170         1   15may1982 23:00:00   16may1982 00:00:00         24 |
                 25. |     8170         1   16may1982 00:00:00   16may1982 01:00:00         25 |
                 26. |     8170         1   16may1982 01:00:00   16may1982 02:00:00         26 |
                 27. |     8170         1   16may1982 02:00:00   16may1982 03:00:00         27 |
                 28. |     8170         1   16may1982 03:00:00   16may1982 04:00:00         28 |
                     +-------------------------------------------------------------------------+
                .
                Can you show your original dataset similar to #3 that generates this?

                Comment


                • #9
                  This is what the original dataset looks like:

                  Code:
                  input str16(edtc dcord_tc) str17 xb_lntdc str27 shiftid str10 phys_name str4 visit_num str9 shiftstart_date str8 shiftstart_time str9(shfitend_date shiftend_time)
                  "  5/17/1982 2:47" " 5/18/1982 10:49" ".4086443"          "17may1982 1 p.m. to 10 p.m." "Andrew" "1"   "17-May-82" "13:00:00" "17-May-82" " 22:00:00"
                  "  7/14/1982 5:49" "  7/14/1982 6:50" ".3384019"          "14jul1982 1 p.m. to 10 p.m." "Andrew" "2"   "14-Jul-82" "13:00:00" "14-Jul-82" " 22:00:00"
                  "  6/30/1982 1:01" "  6/30/1982 2:09" ".3097485"          "30jun1982 11 a.m. to 8 p.m." "Andrew" "3"   "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00"
                  " 5/21/1982 10:51" " 5/22/1982 10:11" ".5928074"          "21may1982 6 a.m. to 4 p.m."  "Andrew" "4"   "21-May-82" "06:00:00" "21-May-82" " 16:00:00"
                  "  5/21/1982 8:18" "  5/21/1982 9:02" "1.174824"          "21may1982 6 a.m. to 4 p.m."  "Andrew" "5"   "21-May-82" "06:00:00" "21-May
                  This is my code for what is above. I ran it line by line and the issue appears in the last 3 lines.

                  Code:
                  ***Combine shift start/end date/time
                  generate shift_start = shiftstart_date + " " + shiftstart_time
                  gen shiftend_date = shfitend_date
                  generate shift_end = shiftend_date + " " + shiftend_time
                  
                  ***Convert string date/time variables to numeric PROBLEM IS ACCOUNTING FOR OVERNIGHT STAYS
                  generate double num_edtc = clock(edtc, "MDYhm")
                  generate double num_dcord = clock(dcord_tc, "MDYhm")
                  gen double num_shift_start1 = clock(shift_start, "DM19Yhms")
                  gen double num_shift_end1 = clock(shift_end, "DM19Yhms")
                  
                  format %tcMonth_dd,_CCYY_HH:MM:SS num_edtc
                  format %tcMonth_dd,_CCYY_HH:MM:SS num_dcord
                  format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_start1
                  format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_end1
                  
                  ***Create admission ID 
                  gen admit_id = _n
                  
                  ***Create index for each day
                  gen num_shiftend_date = date(shiftend_date, "DM19Y")
                  format %tdMonth_dd,_CCYY num_shiftend_date
                  sort num_shiftend_date
                  egen date_id = group(num_shiftend_date)
                  
                  
                  ***Create day duration
                  gen day_start_time = " "
                  gen day_end_time = " "
                  sort date_id
                  by date_id: replace day_start_time = "00:00:00"
                  by date_id: replace day_end_time = "23:59:00"
                  
                  ***Create hour by hour breakdown
                  gen double day_start= clock(trim(shiftstart_date)+"-"+trim(day_start_time), "DM19Yhms")
                  gen double day_end= clock(trim(shiftend_date)+"-"+trim(day_end_time), "DM19Yhms")
                  gen double diff = int((day_end - day_start)/(1000*60*60))
                  
                  format %tcMonth_dd,_CCYY_HH:MM:SS day_start
                  format %tcMonth_dd,_CCYY_HH:MM:SS day_end
                  expand diff
                  
                  *** TROUBLE AREA
                  bys date_id: replace day_start = day_start[_n-1]+(1000*60*60) if _n>1
                  bys date_id: replace day_end = day_start+ (1000*60*60)

                  Comment


                  • #10
                    You are creating the problem by imposing the start and end times to be 24 hour periods rather than the actual shift times.

                    Code:
                    clear
                    input str16(edtc dcord_tc) str17 xb_lntdc str27 shiftid str10 phys_name str4 visit_num str9 shiftstart_date str8 shiftstart_time str9(shfitend_date shiftend_time)
                    "  5/17/1982 2:47" " 5/18/1982 10:49" ".4086443"          "17may1982 1 p.m. to 10 p.m." "Andrew" "1"   "17-May-82" "13:00:00" "17-May-82" " 22:00:00"
                    "  7/14/1982 5:49" "  7/14/1982 6:50" ".3384019"          "14jul1982 1 p.m. to 10 p.m." "Andrew" "2"   "14-Jul-82" "13:00:00" "14-Jul-82" " 22:00:00"
                    "  6/30/1982 1:01" "  6/30/1982 2:09" ".3097485"          "30jun1982 11 a.m. to 8 p.m." "Andrew" "3"   "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00"
                    " 5/21/1982 10:51" " 5/22/1982 10:11" ".5928074"          "21may1982 6 a.m. to 4 p.m."  "Andrew" "4"   "21-May-82" "06:00:00" "21-May-82" " 16:00:00"
                    "  5/21/1982 8:18" "  5/21/1982 9:02" "1.174824"          "21may1982 6 a.m. to 4 p.m."  "Andrew" "5"   "21-May-82" "06:00:00" "21-May
                    end
                    
                    ***Combine shift start/end date/time
                    generate shift_start = shiftstart_date + " " + shiftstart_time
                    gen shiftend_date = shfitend_date
                    generate shift_end = shiftend_date + " " + shiftend_time
                    
                    ***Convert string date/time variables to numeric PROBLEM IS ACCOUNTING FOR OVERNIGHT STAYS
                    generate double num_edtc = clock(edtc, "MDYhm")
                    generate double num_dcord = clock(dcord_tc, "MDYhm")
                    gen double num_shift_start1 = clock(shift_start, "DM19Yhms")
                    gen double num_shift_end1 = clock(shift_end, "DM19Yhms")
                    
                    format %tcMonth_dd,_CCYY_HH:MM:SS num_edtc
                    format %tcMonth_dd,_CCYY_HH:MM:SS num_dcord
                    format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_start1
                    format %tcMonth_dd,_CCYY_HH:MM:SS num_shift_end1
                    
                    ***Create admission ID 
                    gen admit_id = _n
                    
                    ***Create index for each day
                    gen num_shiftend_date = date(shiftend_date, "DM19Y")
                    format %tdMonth_dd,_CCYY num_shiftend_date
                    sort num_shiftend_date
                    egen date_id = group(num_shiftend_date)
                    
                    
                    ***Create day duration
                    gen day_start_time = " "
                    gen day_end_time = " "
                    sort date_id
                    by date_id: replace day_start_time = "00:00:00"
                    by date_id: replace day_end_time = "23:59:00"
                    
                    ***Create hour by hour breakdown
                    
                    gen double start= clock(trim(shiftstart_date)+"-"+trim(shiftstart_time), "DM19Yhms")
                    gen double end= clock(trim(shiftend_date)+"-"+trim(shiftend_time), "DM19Yhms")
                    gen double diff = int((end-start)/(1000*60*60))
                    *gen double diff = int((num_shift_end1-num_shift_start1)/(1000*60*60))
                    
                    expand diff
                    
                    *** TROUBLE AREA
                    bys date_id: replace start = start[_n-1]+(1000*60*60) if _n>1
                    bys date_id: replace end = start+ (1000*60*60)

                    Comment


                    • #11
                      I want to count hour by hour for each day, not shift.

                      Comment


                      • #12
                        That being the case, just extract the date from the start date and create hour observations from that. Then you could have a shift dummy.

                        Code:
                        * Example generated by -dataex-. For more info, type help dataex
                        clear
                        input str10 phys_name str4 visit_num str9 shiftstart_date str8 shiftstart_time str9(shiftend_date shiftend_time)
                        "Andrew" "1" "17-May-82" "13:00:00" "17-May-82" " 22:00:00"
                        "Andrew" "2" "14-Jul-82" "13:00:00" "14-Jul-82" " 22:00:00"
                        "Andrew" "3" "30-Jun-82" "11:00:00" "30-Jun-82" " 20:00:00"
                        "Andrew" "4" "21-May-82" "06:00:00" "21-May-82" " 16:00:00"
                        "Andrew" "5" "21-May-82" "06:00:00" "21-May"    ""        
                        end
                        
                        gen double start= clock(trim(shiftstart_date)+"-"+trim(shiftstart_time), "DM19Yhms")
                        gen double end= clock(trim(shiftend_date)+"-"+trim(shiftend_time), "DM19Yhms")
                        gen double from= clock(trim(shiftstart_date)+"-"+"00:00:00", "DM19Yhms")
                        gen double to= clock(trim(shiftstart_date)+"-"+"00:59:59", "DM19Yhms")
                        expand 24
                        bys phys_name visit_num: replace from= from[_n-1]+(1000*60*60) if _n>1
                        bys phys_name visit_num: replace to = from+ (1000*59.99*60)
                        gen shift= from>= start & to<= end & !missing(end)
                        format start end from to %tc
                        Res.:

                        Code:
                        . l phys_name visit_num start -shift, sepby(phys_name visit_num)
                        
                             +-----------------------------------------------------------------------------------------------------------------+
                             | phys_n~e   visit_~m                start                  end                 from                   to   shift |
                             |-----------------------------------------------------------------------------------------------------------------|
                          1. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 00:00:00   17may1982 00:59:59       0 |
                          2. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 01:00:00   17may1982 01:59:59       0 |
                          3. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 02:00:00   17may1982 02:59:59       0 |
                          4. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 03:00:00   17may1982 03:59:59       0 |
                          5. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 04:00:00   17may1982 04:59:59       0 |
                          6. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 05:00:00   17may1982 05:59:59       0 |
                          7. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 06:00:00   17may1982 06:59:59       0 |
                          8. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 07:00:00   17may1982 07:59:59       0 |
                          9. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 08:00:00   17may1982 08:59:59       0 |
                         10. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 09:00:00   17may1982 09:59:59       0 |
                         11. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 10:00:00   17may1982 10:59:59       0 |
                         12. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 11:00:00   17may1982 11:59:59       0 |
                         13. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 12:00:00   17may1982 12:59:59       0 |
                         14. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 13:00:00   17may1982 13:59:59       1 |
                         15. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 14:00:00   17may1982 14:59:59       1 |
                         16. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 15:00:00   17may1982 15:59:59       1 |
                         17. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 16:00:00   17may1982 16:59:59       1 |
                         18. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 17:00:00   17may1982 17:59:59       1 |
                         19. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 18:00:00   17may1982 18:59:59       1 |
                         20. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 19:00:00   17may1982 19:59:59       1 |
                         21. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 20:00:00   17may1982 20:59:59       1 |
                         22. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 21:00:00   17may1982 21:59:59       1 |
                         23. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 22:00:00   17may1982 22:59:59       0 |
                         24. |   Andrew          1   17may1982 13:00:00   17may1982 22:00:00   17may1982 23:00:00   17may1982 23:59:59       0 |
                             |-----------------------------------------------------------------------------------------------------------------|
                         25. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 00:00:00   14jul1982 00:59:59       0 |
                         26. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 01:00:00   14jul1982 01:59:59       0 |
                         27. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 02:00:00   14jul1982 02:59:59       0 |
                         28. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 03:00:00   14jul1982 03:59:59       0 |
                         29. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 04:00:00   14jul1982 04:59:59       0 |
                         30. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 05:00:00   14jul1982 05:59:59       0 |
                         31. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 06:00:00   14jul1982 06:59:59       0 |
                         32. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 07:00:00   14jul1982 07:59:59       0 |
                         33. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 08:00:00   14jul1982 08:59:59       0 |
                         34. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 09:00:00   14jul1982 09:59:59       0 |
                         35. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 10:00:00   14jul1982 10:59:59       0 |
                         36. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 11:00:00   14jul1982 11:59:59       0 |
                         37. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 12:00:00   14jul1982 12:59:59       0 |
                         38. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 13:00:00   14jul1982 13:59:59       1 |
                         39. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 14:00:00   14jul1982 14:59:59       1 |
                         40. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 15:00:00   14jul1982 15:59:59       1 |
                         41. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 16:00:00   14jul1982 16:59:59       1 |
                         42. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 17:00:00   14jul1982 17:59:59       1 |
                         43. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 18:00:00   14jul1982 18:59:59       1 |
                         44. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 19:00:00   14jul1982 19:59:59       1 |
                         45. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 20:00:00   14jul1982 20:59:59       1 |
                         46. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 21:00:00   14jul1982 21:59:59       1 |
                         47. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 22:00:00   14jul1982 22:59:59       0 |
                         48. |   Andrew          2   14jul1982 13:00:00   14jul1982 22:00:00   14jul1982 23:00:00   14jul1982 23:59:59       0 |
                             |-----------------------------------------------------------------------------------------------------------------|
                         49. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 00:00:00   30jun1982 00:59:59       0 |
                         50. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 01:00:00   30jun1982 01:59:59       0 |
                         51. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 02:00:00   30jun1982 02:59:59       0 |
                         52. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 03:00:00   30jun1982 03:59:59       0 |
                         53. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 04:00:00   30jun1982 04:59:59       0 |
                         54. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 05:00:00   30jun1982 05:59:59       0 |
                         55. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 06:00:00   30jun1982 06:59:59       0 |
                         56. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 07:00:00   30jun1982 07:59:59       0 |
                         57. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 08:00:00   30jun1982 08:59:59       0 |
                         58. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 09:00:00   30jun1982 09:59:59       0 |
                         59. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 10:00:00   30jun1982 10:59:59       0 |
                         60. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 11:00:00   30jun1982 11:59:59       1 |
                         61. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 12:00:00   30jun1982 12:59:59       1 |
                         62. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 13:00:00   30jun1982 13:59:59       1 |
                         63. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 14:00:00   30jun1982 14:59:59       1 |
                         64. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 15:00:00   30jun1982 15:59:59       1 |
                         65. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 16:00:00   30jun1982 16:59:59       1 |
                         66. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 17:00:00   30jun1982 17:59:59       1 |
                         67. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 18:00:00   30jun1982 18:59:59       1 |
                         68. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 19:00:00   30jun1982 19:59:59       1 |
                         69. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 20:00:00   30jun1982 20:59:59       0 |
                         70. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 21:00:00   30jun1982 21:59:59       0 |
                         71. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 22:00:00   30jun1982 22:59:59       0 |
                         72. |   Andrew          3   30jun1982 11:00:00   30jun1982 20:00:00   30jun1982 23:00:00   30jun1982 23:59:59       0 |
                             |-----------------------------------------------------------------------------------------------------------------|
                         73. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 00:00:00   21may1982 00:59:59       0 |
                         74. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 01:00:00   21may1982 01:59:59       0 |
                         75. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 02:00:00   21may1982 02:59:59       0 |
                         76. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 03:00:00   21may1982 03:59:59       0 |
                         77. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 04:00:00   21may1982 04:59:59       0 |
                         78. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 05:00:00   21may1982 05:59:59       0 |
                         79. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 06:00:00   21may1982 06:59:59       1 |
                         80. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 07:00:00   21may1982 07:59:59       1 |
                         81. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 08:00:00   21may1982 08:59:59       1 |
                         82. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 09:00:00   21may1982 09:59:59       1 |
                         83. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 10:00:00   21may1982 10:59:59       1 |
                         84. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 11:00:00   21may1982 11:59:59       1 |
                         85. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 12:00:00   21may1982 12:59:59       1 |
                         86. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 13:00:00   21may1982 13:59:59       1 |
                         87. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 14:00:00   21may1982 14:59:59       1 |
                         88. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 15:00:00   21may1982 15:59:59       1 |
                         89. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 16:00:00   21may1982 16:59:59       0 |
                         90. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 17:00:00   21may1982 17:59:59       0 |
                         91. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 18:00:00   21may1982 18:59:59       0 |
                         92. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 19:00:00   21may1982 19:59:59       0 |
                         93. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 20:00:00   21may1982 20:59:59       0 |
                         94. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 21:00:00   21may1982 21:59:59       0 |
                         95. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 22:00:00   21may1982 22:59:59       0 |
                         96. |   Andrew          4   21may1982 06:00:00   21may1982 16:00:00   21may1982 23:00:00   21may1982 23:59:59       0 |
                             |-----------------------------------------------------------------------------------------------------------------|
                         97. |   Andrew          5   21may1982 06:00:00                    .   21may1982 00:00:00   21may1982 00:59:59       0 |
                         98. |   Andrew          5   21may1982 06:00:00                    .   21may1982 01:00:00   21may1982 01:59:59       0 |
                         99. |   Andrew          5   21may1982 06:00:00                    .   21may1982 02:00:00   21may1982 02:59:59       0 |
                        100. |   Andrew          5   21may1982 06:00:00                    .   21may1982 03:00:00   21may1982 03:59:59       0 |
                        101. |   Andrew          5   21may1982 06:00:00                    .   21may1982 04:00:00   21may1982 04:59:59       0 |
                        102. |   Andrew          5   21may1982 06:00:00                    .   21may1982 05:00:00   21may1982 05:59:59       0 |
                        103. |   Andrew          5   21may1982 06:00:00                    .   21may1982 06:00:00   21may1982 06:59:59       0 |
                        104. |   Andrew          5   21may1982 06:00:00                    .   21may1982 07:00:00   21may1982 07:59:59       0 |
                        105. |   Andrew          5   21may1982 06:00:00                    .   21may1982 08:00:00   21may1982 08:59:59       0 |
                        106. |   Andrew          5   21may1982 06:00:00                    .   21may1982 09:00:00   21may1982 09:59:59       0 |
                        107. |   Andrew          5   21may1982 06:00:00                    .   21may1982 10:00:00   21may1982 10:59:59       0 |
                        108. |   Andrew          5   21may1982 06:00:00                    .   21may1982 11:00:00   21may1982 11:59:59       0 |
                        109. |   Andrew          5   21may1982 06:00:00                    .   21may1982 12:00:00   21may1982 12:59:59       0 |
                        110. |   Andrew          5   21may1982 06:00:00                    .   21may1982 13:00:00   21may1982 13:59:59       0 |
                        111. |   Andrew          5   21may1982 06:00:00                    .   21may1982 14:00:00   21may1982 14:59:59       0 |
                        112. |   Andrew          5   21may1982 06:00:00                    .   21may1982 15:00:00   21may1982 15:59:59       0 |
                        113. |   Andrew          5   21may1982 06:00:00                    .   21may1982 16:00:00   21may1982 16:59:59       0 |
                        114. |   Andrew          5   21may1982 06:00:00                    .   21may1982 17:00:00   21may1982 17:59:59       0 |
                        115. |   Andrew          5   21may1982 06:00:00                    .   21may1982 18:00:00   21may1982 18:59:59       0 |
                        116. |   Andrew          5   21may1982 06:00:00                    .   21may1982 19:00:00   21may1982 19:59:59       0 |
                        117. |   Andrew          5   21may1982 06:00:00                    .   21may1982 20:00:00   21may1982 20:59:59       0 |
                        118. |   Andrew          5   21may1982 06:00:00                    .   21may1982 21:00:00   21may1982 21:59:59       0 |
                        119. |   Andrew          5   21may1982 06:00:00                    .   21may1982 22:00:00   21may1982 22:59:59       0 |
                        120. |   Andrew          5   21may1982 06:00:00                    .   21may1982 23:00:00   21may1982 23:59:59       0 |
                             +-----------------------------------------------------------------------------------------------------------------+
                        
                        .
                        Last edited by Andrew Musau; 29 Apr 2022, 06:11.

                        Comment

                        Working...
                        X