Hello,
This is regarding the continuous enrollment. I have the initial and final datasets below and In the initial data set, even though the FEB Record is missing still it needs to come as continuous enrollment.
Could anyone of you help on this?
Initial Table | |||
mem_id | plan | bdate | edate |
123 | a | 1/1/2014 | 1/31/2014 |
123 | a | 3/1/2014 | 3/30/2014 |
123 | b | 4/1/2014 | 04/31/2014 |
123 | b | 5/1/2014 | 5/30/2014 |
123 | b | 6/1/2014 | 06/31/2014 |
123 | a | 7/1/2014 | 7/30/2014 |
123 | a | 8/1/2014 | 8/31/2014 |
123 | a | 9/1/2014 | 9/30/2014 |
Final Table | |||
mem_id | plan | bdate | edate |
123 | a | 1/1/2014 | 3/30/2014 |
123 | b | 4/1/2014 | 06/31/2014 |
123 | a | 7/1/2014 | 9/30/2014 |
Here's an easy way, as long as these are the only variables involved. Assuming that the data are properly sorted as you have illustrated:
proc summary data=have;
by mem_id plan notsorted;
var bdate edate;
output out=want (keep=mem_id plan bdate edate) min(bdate)=bdate max(edate)=edate;
run;
If you have additional variables that need to be carried through the process, it can get more complicated.
Good luck.
Thank you so much,it did worked.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.