BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
11427qvolaf
Calcite | Level 5

A research analyst is asked to calculate overall response time, using two times in their SAS dataset: dispatch time (format hh:mm:ss) and hospital arrival time (format hh:mm).  What would be the SAS or SQL code to calculate the response time.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

@11427qvolaf  - Welcome to the SAS Community. Please be aware it is not considered good form to post SAS homework questions without:

  • Posting the example data referred to in the question
  • Posting evidence of trying to answer the question yourself

View solution in original post

2 REPLIES 2
SASKiwi
PROC Star

@11427qvolaf  - Welcome to the SAS Community. Please be aware it is not considered good form to post SAS homework questions without:

  • Posting the example data referred to in the question
  • Posting evidence of trying to answer the question yourself
japelin
Rhodochrosite | Level 12

First of all, it is recommended that you include appropriate words in the subject.
Also, it is easier to get an answer if you provide sample data, variables, and exact conditions in your question.

 

Then, to answer your question
Since the formatting seems to be applied to both times, they can actually be subtracted directly as numeric data, as follows.

 

data want;
  set have;
  response_time=hospital_arrival_time-dispatch_time;
run;

 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 582 views
  • 0 likes
  • 3 in conversation