data have;
input ID $ start_date : mmddyy10. end_date : mmddyy10.;
format start_date end_date mmddyy10.;
cards;
A 1/1/17 1/10/17
A 1/11/17 1/14/17
A 1/20/17 1/22/17
B 1/4/17 1/8/17
;
run;
data temp;
set have;
by id;
if first.id or start_date ne lag(end_date)+1 then group+1;
run;
data want;
set temp(rename=(start_date=_start_date));
by group;
retain start_date;
if first.group then start_date=_start_date;
if last.group;
format start_date mmddyy10.;
drop _start_date;
run;
... View more