OK. How big table do you have ?
If you really care about efficiency problem , try this one .
data have;
input Coverage_Start : date11. Termination_Date : date11. Member_Id;
format Coverage_Start Termination_Date date11. ;
cards;
24-Jul-19 1-Jun-21 42968701
24-Jul-19 1-Mar-21 42968701
29-Feb-20 1-Mar-20 42968701
16-Feb-19 1-Mar-19 42968701
1-Mar-17 1-Mar-18 42968701
1-Mar-16 1-Mar-17 42968701
1-Dec-15 31-Dec-16 42968701
;
data want;
array date{99999} _temporary_ ;
do until(last.Member_Id);
set have;
by Member_Id;
do i=Coverage_Start to Termination_Date;
date{i}=1;min=min(min,i);max=max(max,i);
end;
end;
do i=min to max;
if missing(date{i-1}) and not missing(date{i}) then start=i;
if missing(date{i+1}) and not missing(date{i}) then do;end=i;output;end;
end;
call missing(of date{*});
format start end date11.;
keep Member_Id start end;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.