Hi,
I have a data set with wait time data.
exemple:
| Patient | Admission date/time | Left ER date time | Wait time |
| A | 2015-11-02 5:00 | 2015-11-02 19:30 | 14:30:00 |
| B | 2015-11-05 8:12 | 2015-11-05 17:30 | 9:18:00 |
| C | 2015-11-14 5:00 | 2015-11-15 19:30 | 38:30:00 |
| Total wait time | 62:18:00 |
I would like to be able to count the total number (in hours and in minutes) waiting time in the room.
thank you
Try this:
wait_time=intck('second',input(admission_dt,anydtdtm.), input(left_dt,anydtdtm.));
format wait_time time8.;
Wait duration is simply the difference between the datetimes. Give the difference a hhmm8. format to display hours (may be more than 24) and minutes.
waitTime = left_ER_DT - admission_DT;
format waitTime hhmm8.;
Hi, thank you for the answer,
I can calculate the wait for each patient using the difference between the datetimes but after that, I need to calculate the mean of all patient wait by day and doesn't seem that I can do just a mean
Which day? The day they got in, got out, or the total number of hour-person waited every day in ER?
Hi,
They ask me: by month,day and hour of the day using the registration Date
They want the average wait in minutes and in hours (and not in this file exemple but I will need to give the information by service and by unit of admission)
|
Patient |
Registration Date | Admission date/time | Left ER date time | Wait time |
| A | 2015-11-02 2:00 | 2015-11-02 5:00 | 2015-11-02 19:30 | 14:30:00 |
| B | 2015-11-05 4:12 | 2015-11-05 8:12 | 2015-11-05 17:30 | 9:18:00 |
| C | 2015-11-14 3:00 | 2015-11-14 5:00 | 2015-11-15 19:30 | 38:30:00 |
Then it' s simple
proc sql;
create table waitTimes as
select
datepart(registrationDT) as registrationDate format=yymmdd10.,
mean(left_ER_DT-Admission_DT) as waitTime format=hhmm8.
from myData
group by calculated registrationDate;
quit;
Thank you, it's working well.
Line
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.