I have a dataset containing Medicaid claims data, and I want to subset the data to include only individuals who have at least 11 months of continuous enrollment (with at least 15 days of enrollment per each month). The problem is, I have three year's worth of data (2005-2008), so an individual may have only a few months of enrollment in each year they were seen, but it may or may not total the number of months of continuous enrollment that I desire. For example, patient #1001 has claims for 2005 and 2006. Her enrollment began in September 2005 and continued through December 2005, giving her 4 months of continuous enrollment in 2005. Her enrollment then continued from January 2006 to July 2006, giving her 7 months of continuous enrollment in 2006, for a total of 11 months of continuous enrollment. Therefore, I would want to include this person in my dataset. Another example: patient #1003 has claims for 2007 and 2008. He had enrollment in 2007 starting in the month of May through December, giving him a total of 8 months of enrollment in 2007. However, in 2008 he only had one month of enrollment in January, giving him a grand total of 9 months of enrollment. Therefore, I do not want to include patient #1003 in my dataset. What I need is help with is determining the number of months of continuous enrollment, having one number per ID. The variables I have are ID, days_enrollment1-days_enrollment12 (these are number of days of enrollment for January[1]-December[12]), eligible_months (this is # of months eligible for Medicaid per year), and year (year of enrollment, 2005-2008). Again, an individual may have claims filed for multiple years, but I need to find a way to sum up the number of months of continuous enrollment. I feel like the solution to this problem is either really difficult or really easy. Please advise. Thank you in advance.
... View more