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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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