Begin block whole |
Open a programming block. |
Define “age” as ex: (today-“birth”)/365.25 |
Compute patient's current age. |
If “age” is ge 65 then save “one” as “oldpt” {integer} |
Define a variable “oldpt” that is one if the patient is 65 years of age or older the day the program runs. |
If any “oldpt” exists then continue else exit whole |
If a patient is at least 65 years of age, then continue collecting the data listed below; otherwise, close the programming block and move on to the next patient's record. |
If any “Drug A” [>0] exists then continue else exit whole |
If a patient has been prescribed Drug A in a dose greater than zero, then continue collecting the data listed below; otherwise, close the programming block and move on to the next patient's record. |
Define “drug_fst” as first “Drug A” [>0] exists |
Find the date of first use of Drug A. |
Define “drug_lst” as last “Drug A” [>0] exists |
Find the date of last use of Drug A. |
If any “er dx” [on_after “fst_date” & before “lst_date”] exists then save “one” {integer} as “evr_er” else save “zero” {integer} as “evr_er” |
If the patient has received a diagnosis from the emergency department on the date of the prescription for Drug A but before the date of the last prescription, then set to one the variable “evr_er”; otherwise, set the variable to zero. |
If any “Drug B” [after “fst_date” & >0] exists then save “one” as “Drug B” {integer} else save “zero” as “Drug B” {integer} |
If the patient has received a prescription for any Drug B after the date of the first prescription for Drug A, then set to one the variable “Drug B”; otherwise, set the variable to zero. |
End block whole |
Close the programming block. |