Announcement

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

  • How to calculate overlapping dates in stata

    Hello,
    I am working on a patient dataset in which I need to calculate the time spent in each room based on a 24 hr range. We have information on room, in_time- the time checked in the room, out_time- time checkout form that room. We also have information on collection time for a sample collected disease for X. We want to know the amount of time spent in all rooms from 24hrs before collection time until collection time. The goal is to flag the room where a patient spent most time in the 24hrs before sample was collected. For this we need to calculate the times spent in all rooms the patient visited during this time frame. Appreciate your help. (This is a made up sample)

    Thank you

    Room number In_time Out_time Collection_time 24Hrs_prior_to_collection
    Room A 07-august-2022, 04:30 08-august-2022 03:47 09_august-2022 18:02 08_august-2022
    18:02
    Room B 08-august_2022
    03:48
    08_august_2022
    23:47
    09_august-2022 18:02 08_august-2022
    18:02
    Room C 08_august_2022 23:48 10_august_2022
    10:01
    09_august-2022 18:02 08_august-2022
    18:02

  • #2
    Duplicate post. If interested, see https://www.statalist.org/forums/for...dates-in-stata

    Comment

    Working...
    X