BookmarkSubscribeRSS Feed
LVeilleux
Calcite | Level 5

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

7 REPLIES 7
slchen
Lapis Lazuli | Level 10

Try this:

wait_time=intck('second',input(admission_dt,anydtdtm.), input(left_dt,anydtdtm.));
format wait_time time8.;

PGStats
Opal | Level 21

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.;

PG
LVeilleux
Calcite | Level 5

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

PGStats
Opal | Level 21

Which day? The day they got in, got out, or the total number of hour-person waited every day in ER?

PG
LVeilleux
Calcite | Level 5

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
PGStats
Opal | Level 21

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;
PG
LVeilleux
Calcite | Level 5

Thank you, it's working well.

 

Line

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2925 views
  • 0 likes
  • 3 in conversation