Based on my experience on working with the data from clinical trials having such a build-in SAS function would be really helpful! Since every now and again I faced a need to get durations of certain events, such as time from pre-onset of adverse event to time when such event can be considered as resolved (not only based on actual onset/stop dates, but also considering other related timing info, such as date when corresponding lab parameter showed increase/decrease), etc.

I think that the main advantage of the approach described above is that all derivations can be done within one data step.

Below is a SAS code that I'm currently (when needed) using to handle the same (since up to date there is no such HOP function). It is based on the capabilities of PROC SQL:

data sample;
do date_in=today() to today()+30;
date_out=date_in+rand('integer',1,6);
fail_flag=ifn(weekday(date_in)=5,1,0);
row+1;
output;
end;
format date_in date_out date9.;
run;

proc sql;
create table get_delta as
select *,
case
when a.fail_flag
then (select date_out from sample where row=a.row+1) - (select date_in from sample where row=a.row-2)
else .
end as delta
from sample as a;
quit;