I have a database of patient-level discharges and I am trying to calculate AHRQ Prevention Quality Indicators in Stata. For each discharge I want to generate new variable for each PQI that is coded "0" No or "1" Yes.
The attached is example code I generated for calculating PQI 1, and it works as indented. However, there are multiple PQIs and some of them have hundreds of diagnosis codes across pdx (primary diagnoses) and sdx# (secondary diagnoses 1-15). How do I efficiently code this? I looked into macros, but couldn't figure out how to specify a long list of values (>500) for a particular variable.
The attached is example code I generated for calculating PQI 1, and it works as indented. However, there are multiple PQIs and some of them have hundreds of diagnosis codes across pdx (primary diagnoses) and sdx# (secondary diagnoses 1-15). How do I efficiently code this? I looked into macros, but couldn't figure out how to specify a long list of values (>500) for a particular variable.