I have panel data of multiple visits of patients. In my analysis, I want to look at the loss of retention over time with a survival analysis. Retention is defined as 2 visit dates that were at least 90 days apart in the measurement year. Therefore I cannot just use the last visit date as the date they fell out of care as many may have had one visit after initiating treatment, and then not returned for a year only to start treatment again. Below is a brief look into some of the data:
The first variable is the ID, the second is the various visit date and the last is the date they started the treatment. How could I code a variable with the last visit date where they did not fulfil the definition on 2 visits in a year (a year after starting treatment, not starting January 1st) more than 90 days apart. Thanks in advance for your time and help!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double id float(visit_date art_start_date) 25 21091 21091 25 21091 21091 25 21091 21091 25 21091 21091 25 21091 21091 25 21091 21091 25 21104 21091 25 21104 21091 25 21104 21091 25 21122 21091 25 21122 21091 25 21122 21091 25 21235 21091 25 21325 21091 25 21325 21091 25 21325 21091 25 21355 21091 25 21355 21091 25 21355 21091 25 21388 21091 25 21629 21091 25 21629 21091 25 21629 21091 25 21839 21091 25 21839 21091 25 21875 21091 25 21875 21091 25 21941 21091 25 21941 21091 25 21941 21091 end format %td visit_date format %td art_start_date
Comment