wonderful. try this.
data have;
set have;
dt=input(dtc,date7.);
format dt date7.;
year=year(dt);
run;
proc sort data= have;by dt;
run;
data have1;
set have;
by dt;
retain _dt;
_dt=lag(dt);
if _n_=1 then _dt=dt;
day=dt-_dt+1;
mon6=ceil(day/182.5);
mon12=ceil(day/365);
format _dt date7.;
drop id year dtc;
run;
*** overall avg ;
proc sql noprint;
create table avg1 as
select mean(day) as avg1
from have1;
quit;
*** 6 mon avg;
proc sql noprint;
create table _avg6 as
select mon6, mean(day) as _avg6
from have1
group by mon6;
quit;
proc sql noprint;
create table avg6 as
select mean(_avg6) as avg6
from _avg6
;
quit;
*** 12 mon avg;
proc sql noprint;
create table _avg12 as
select mon6, mean(day) as _avg12
from have1
group by mon12;
quit;
proc sql noprint;
create table avg12 as
select mean(_avg12) as avg12
from _avg12
;
quit;
if this works you can add var 'year' in by statements starting with proc sort and instead of 'if _n_=1....' use 'if first.year....'