0
votes

I have a dataset i.e. -

Coverage_Start  Termination_Date    Member_Id
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

I want to reduce this dataset, suppose in last three rows minimum coverage_start- 1-Dec-15 and maximum termination_date- 1-Mar-18, so I want to combine all three bottom rows because it has continuous coverage. As result the bottom three rows will be reduced to "1-Dec-15 1-Mar-18 42968701".

Reduced Dataset should be like -

Coverage_Start  Termination_Date    Member_Id
24-Jun-19       1-Jun-21            42968701
16-Feb-19       1-Mar-19            42968701
1-Dec-15        1-Mar-18            42968701

I want to achieve this task using SAS programming. Can anyone please help me with this? I'm trying this since a very log time but couldn't achieve it.

Please include anything you've tried. - Reeza
Can we use lag function on termination date and then find the difference between the coverage start and termination then we put a condition if difference <= 1 the set coverage_min= min(coverage_start) and termination=max(termination) and when difference >1 we update the coverage_min to a new minimum date? It is just an idea not sure how to implement it. - rahul gupta
Yes, there's a LAG() function. Show what you've tried by adding your code to the question via an edit please. - Reeza