What do you mean by "the average number of months between events"?
Can you post some real data and the desired output you are looking for ?
data have;
input id date date9.;
format date date9.;
cards;
1 01jan2010
1 01mar2011
1 01feb2012
2 01nov2010
2 01mar2011
2 01dec2014
;
proc sort data=have out=temp;
by id date;
run;
data temp;
set temp;
by id;
n_month=intck('month',lag(date),date,'c');
if first.id then call missing(n_month);
run;
proc summary data=temp;
by id;
var n_month;
output out=want mean=;
run;
... View more