Hey @maguiremq Thank you so much for doing this! i'm new to the community, will definitely make the reproducible form myself next time. And my date is in year-month-day format, you are correct! So as I replied to @ChrisNZ , Patient ID 1 only had one record. I'm comparing the start_dt with fst_dt to see if the difference <12 months, if yes, then exclude, otherwise keep. start_dt is the diagnosis date for prioir_dx. fst_dt is the diagnosis date for dx. In this case, 2016-8-1 is within the 12-month window of 2017-1-1, so patient ID 1 should be dropped. Patient ID 1 only has inpatient diagnosis (inpatient=1) so the exclusion criteria is at least one prior diagnosis within 12 months. But for patient ID 2, he/she had outpatient diagnosis (inpatient=0) only, the exclusion criteria is at least two prior diagnosis within 12 months. So it's keeped. Thank you! Looking forward to your response!
... View more