@leam3 wrote:
I am trying to figure out if a new procedure change implemented between year 1 and year 2 has caused a delay in the procedure being administered. I have a procedure start time and procedure end time which are both time. formatted, and subtracted the difference to create a variable = duration between start and finish times (which is also formatted as a time).
I would like to find the average of these durations, but proc means does not maintain the time format. I have searched several threads and tried many of their suggestions but have not yet found a solution.
I have tried doing an output= option with proc means, but I'm not sure this is exactly what I need because ideally I would like to be able to calculate different averages of duration based on other different variables/strata in addition to year.
Thanks for your help!
Proc Means, and its cousin Proc Summary, will allow you do get summaries by multiple strata with a single pass through the data.
Place all of the strata variables, including year, in a CLASS statement.
The output data set, which you will want, will have a variable _type_ that indicates the combination of strata variables involved for any summary row. _TYPE_=0 is overall, i.e. not stratified and _TYPE_ = 2**n - 1, where n= number of class variables, it the combination of all of the strata. By selecting the correct _type_ you can examine any desired combination.
Assign the appropriate format to the statistics in a following data step or Report procedure syntax.