A simple SQL will do it if a data set is small. The first solution is slight better.
Both solutions involve a Cartesian product join which will cause a performance issue if the data set has more than 10 thousands rows. If this is a case, a more efficient way will be a data step.
data tmp;
/* do date='1jan1980'd to '31jan2014'd;*/
do date='1jan2014'd to '31jan2014'd;
if ranuni(123)>0.3 then output;
end;
format date yymmdd10.;
run;
proc sql;
create table tmp2 as
select a.date , b.date as date2
from tmp a join tmp b on (b.date=a.date or b.date=a.date+1 or b.date=a.date+2)
group by 1
having count(a.date)=3
order by 1,2
;
quit;
proc sql;
create table tmp2 as
select a.date , b.date as date2
from tmp a , tmp b
where 0<=(b.date-a.date)<=2
group by 1
having count(a.date)=3
order by 1,2
;
quit;