Hi,
I’m working with an EHR dataset and I need help creating a polypharmacy (yes/no) variable for my study. Polypharmacy definition (for my study): ≥5 medications taken simultaneously for ≥90 days within the 6 months (183 days) prior to the index date.
I have individual-level medication data including medication name, status, start date, end date, and discontinued date, along with the index date.
Medication status is recorded as “active,” “complete,” or “discontinued.” For active medications, only the start date is available; for completed medications, there is an end date; and for discontinued medications, there is a discontinued date. I need to account for overlapping periods of medications to identify patients who meet the polypharmacy criteria.
* Example generated by -dataex-. To install: ssc install dataex
clear
input str1 id str5 med str12 medstat str10(stdate endate disdate)
"1" "med A" "Active" "6/26/2023" "." "."
"1" "med B" "Complete" "6/27/2023" "2/4/2024" "."
"1" "med C" "Complete" "6/27/2023" "11/17/2023" "."
"1" "med D" "Discontinued" "6/28/2023" "." "7/19/2023"
"1" "med E" "Active" "6/27/2023" "." "."
"1" "med F" "Complete" "6/26/2023" "11/12/2023" "."
"1" "med G" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med H" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med I" "Discontinued" "6/26/2023" "." "6/27/2023"
"1" "med J" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med K" "Discontinued" "6/27/2023" "." "7/19/2023"
end
Thank you so much for your help.
I’m working with an EHR dataset and I need help creating a polypharmacy (yes/no) variable for my study. Polypharmacy definition (for my study): ≥5 medications taken simultaneously for ≥90 days within the 6 months (183 days) prior to the index date.
I have individual-level medication data including medication name, status, start date, end date, and discontinued date, along with the index date.
Medication status is recorded as “active,” “complete,” or “discontinued.” For active medications, only the start date is available; for completed medications, there is an end date; and for discontinued medications, there is a discontinued date. I need to account for overlapping periods of medications to identify patients who meet the polypharmacy criteria.
* Example generated by -dataex-. To install: ssc install dataex
clear
input str1 id str5 med str12 medstat str10(stdate endate disdate)
"1" "med A" "Active" "6/26/2023" "." "."
"1" "med B" "Complete" "6/27/2023" "2/4/2024" "."
"1" "med C" "Complete" "6/27/2023" "11/17/2023" "."
"1" "med D" "Discontinued" "6/28/2023" "." "7/19/2023"
"1" "med E" "Active" "6/27/2023" "." "."
"1" "med F" "Complete" "6/26/2023" "11/12/2023" "."
"1" "med G" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med H" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med I" "Discontinued" "6/26/2023" "." "6/27/2023"
"1" "med J" "Discontinued" "6/26/2023" "." "2/4/2024"
"1" "med K" "Discontinued" "6/27/2023" "." "7/19/2023"
end
Thank you so much for your help.

Comment