I had the idea of creating multilabel formats from the dates in the data, this will enable you to use certain SAS procedures (SUMMARY, MEANS, TABULATE, REPORT) to calculate the measures of interest. This means you have access to the percentiles 1,5,10,25,50,75,90,95,99. You would normally use PROC UNIVARIATE to calculate other percentiles, but unfortunately this procedure doesn't support multilabel formats. Here is my code, which uses the intitial dataset created by KSharp (although I don't need the MONTH column). %let bin=3; proc sql noprint; select min(date), intck('month',min(date),max(date)) into :min_dt, :num_mths from x; quit; data mth_fmt; format start end monyy5.; retain fmtname 'roll_mth' type 'N' hlo 'M'; do i=0 to &num_mths.; start=intnx('month',&min_dt.,i-&bin.+1); end=intnx('month',start,&bin.-1,'e'); label=vvalue(end); output; end; drop i; run; proc format cntlin=mth_fmt; run; proc summary data=x nway; class date / mlf order=data; format date roll_mth.; var value; output out=want (drop=_:) mean= median= p75= n= / autoname; run;
... View more