-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmme_list.do
328 lines (254 loc) · 17.1 KB
/
mme_list.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
* CDC Opioid List
/*
This file is a list from the CDC with morphine MMEs for every 11 digit NDC code.
In that case it is probably better / more useful.
*/
global op_fp "/Users/austinbean/Google Drive/Current Projects/HCCI Opioids/"
global op_pr "/Users/austinbean/Desktop/programs/opioids/"
* opioids w/ MME from CDC, plus maybe some additions. Source was pdmpassist.org
* If this list has all of the NDCs, then it's a better list anyway. So: use this instead of what we already have. Ask them to upload it as a table.
if 0{
clear
import excel "${op_fp}Conversion Reference Table.xlsx", sheet("Opioids") firstrow
gen productndc = substr(NDC, 1, 9)
drop if MME_Conversion_Factor == . // there is one product with a missing MME
save "${op_fp}opioid_mme.dta", replace
export delimited using "/Users/austinbean/Desktop/programs/opioids/opioid_11digitNDC_mmes.csv", replace
}
* another import of the CDC list:
import excel "${op_pr}CDC_Oral_Morphine_Milligram_Equivalents_Sept_2018.xlsx", sheet("Opioids") firstrow clear
rename NDC ndc_code // note that ndc_code is different from ndccode and query code in the drug_characteristics.dta file.
save "${op_pr}mme_by_ndc.dta", replace
/*
https://www.cms.gov/Medicare/Prescription-Drug-Coverage/PrescriptionDrugCovContra/Downloads/Oral-MME-CFs-vFeb-2018.pdf
Buprenorphine film/tabletiii (mg)
Buprenorphine patchiii(mcg/hr)
Buprenorphine filmiii (mcg)
Butorphanol (mg) 7
Codeine (mg) 0.15
Dihydrocodeine (mg) 0.25
Fentanyl buccal or SL tablets, or lozenge/trocheiv
(mcg)
0.13
Fentanyl film or oral sprayv (mcg) 0.18
Fentanyl nasal sprayvi (mcg) 0.16
Fentanyl patchvii (mcg) 7.2
Hydrocodone (mg) 1
Hydromorphone (mg) 4
Levorphanol tartrate (mg) 11
Meperidine hydrochloride (mg) 0.1
Methadoneviii (mg) 3
>0, <= 20 4
>20, <=40 8
>40, <=60 10
>60 12
Morphine (mg) 1
Opium (mg) 1
Oxycodone (mg) 1.5
Oxymorphone (mg) 3
Pentazocine (mg) 0.37
Tapentadolix (mg) 0.4
Tramadol (mg) 0.1
another: https://apps.health.ny.gov/pub/ctrldocs/bne/nyosammeformulation.pdf
A calculator...
https://www1.nyc.gov/site/doh/providers/health-topics/mme-calculator.page
This is what I need to use.
https://ww2.health.wa.gov.au/-/media/Files/Corporate/general-documents/Health-Networks/WA-Cancer-and-Palliative-Care/How-to-use-the-Opioid-Conversion-Guide.pdf
https://www.palliativedrugs.com/download/081230_Opioid%20_Conversion_Chart_08.pdf
A list by NDC:
https://www.cdc.gov/drugoverdose/data-files/CDC_Oral_Morphine_Milligram_Equivalents_Sept_2018.xlsx
*/
use "/Users/austinbean/Desktop/programs/opioids/drug_characteristics.dta", clear
// merge 1:1 ndc_code using "${op_pr}mme_by_ndc.dta"
// todo this has a mistake b/c now a bunch of non-opioids will get MME's
split substancename, p(";")
split strengthunit, p(";")
split strengthnumber, p(";")
rename substancename xsubsname
rename strengthnumber xstrengthnum
rename strengthunit xstrengthu
reshape long substancename strengthunit strengthnumber, i(ndc_code) j(sbctr)
drop if substancename == ""
keep substancename strengthunit strengthnumber
replace substancename = strtrim(substancename) // a few codeine entries have a leading space.
replace strengthnumber = strtrim(strengthnumber) // more spaces
replace strengthunit = strtrim(strengthunit) // also
duplicates drop substancename strengthunit strengthnumber , force
sort substancename strengthunit strengthnumber
* TODO - can also think about identifying painkillers this way to get market share right.
* MME
gen codeine = regexm(lower(substancename), "codeine")
gen fentanyl = regexm(lower(substancename), "fentanyl")
gen hydrocodone = regexm(lower(substancename), "hydrocodone")
gen hydromorphone = regexm(lower(substancename), "hydromorphone")
gen methadone = regexm(lower(substancename), "methadone")
gen morphine = regexm(lower(substancename), "morphine")
gen oxycodone = regexm(lower(substancename), "oxycodone")
gen oxymorphone = regexm(lower(substancename), "oxymorphone")
gen tramadol = regexm(lower(substancename), "tramadol")
gen pentazocine = regexm(lower(substancename), "pentazocine")
gen opium = regexm(lower(substancename), " opium")
gen meperidine = regexm(lower(substancename), "meperidine")
gen butorphanol = regexm(lower(substancename), "butorphanol")
egen non_zero_mme = rowtotal(codeine fentanyl hydrocodone hydromorphone methadone morphine oxycodone oxymorphone tramadol pentazocine opium meperidine butorphanol)
* note: no drug in the data has two opioids from this list among its ingredients.
preserve
keep if non_zero_mme == 0
save "/Users/austinbean/Desktop/programs/opioids/no_mme_active_ingredients.dta", replace
restore
keep if non_zero_mme == 1
gen mme = 0
if 0 { // this loop is just needed to generate some statements programmatically.
qui levelsof substancename, local(subs)
foreach sb of local subs{
qui levelsof strengthunit if substancename == "`sb'", local(strens)
foreach streng of local strens{
qui levelsof strengthnumber if substancename == "`sb'" & strengthunit == "`streng'", local(units)
foreach un of local units{
di "replace mme = if substancename == `sb' & strengthunit == `streng' & strengthnumber == `un'"
}
}
}
}
* codeine
replace mme = 2.3 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/1" & strengthnumber == "15"
replace mme = 2.45 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/1" & strengthnumber == "16"
replace mme = 4.5 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 9 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/1" & strengthnumber == "60"
replace mme = 0.31 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/5mL" & strengthnumber == "10"
replace mme = 1.15 if substancename == "CODEINE PHOSPHATE" & strengthunit == "mg/5mL" & strengthnumber == "7.5"
* TODO - are these perfect substitutes? Phosphate and sulfate
replace mme = 2.3 if substancename == "CODEINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "15"
replace mme = 4.5 if substancename == "CODEINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 9 if substancename == "CODEINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "60"
* fentanyl
* these are per hour, so they are patches.
replace mme = 240 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "100"
replace mme = 30 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "12"
replace mme = 30 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "12.5"
replace mme = 60 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "25"
replace mme = 120 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "50"
replace mme = 180 if substancename == "FENTANYL" & strengthunit == "ug/h" & strengthnumber == "75"
* These are a bit uncertain
replace mme = 156 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "1200"
replace mme = 208 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "1600"
replace mme = 26 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "200"
replace mme = 52 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "400"
replace mme = 78 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "600"
replace mme = 104 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/1" & strengthnumber == "800"
replace mme = 6.5 if substancename == "FENTANYL CITRATE" & strengthunit == "ug/mL" & strengthnumber == "50"
* hydrocodone
replace mme = 10 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/1" & strengthnumber == "10"
replace mme = 5 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/1" & strengthnumber == "5"
replace mme = 7.5 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/1" & strengthnumber == "7.5"
replace mme = 0.5 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/15mL" & strengthnumber == "7.5"
replace mme = 0.5 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/5mL" & strengthnumber == "2.5"
replace mme = 1 if substancename == "HYDROCODONE BITARTRATE" & strengthunit == "mg/5mL" & strengthnumber == "5"
* hydromorphone
replace mme = 8 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "2"
replace mme = 12 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "3"
replace mme = 16 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "4"
replace mme = 32 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "8"
replace mme = 4 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/mL" & strengthnumber == "1"
replace mme = 40 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/mL" & strengthnumber == "10"
replace mme = 8 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/mL" & strengthnumber == "2"
replace mme = 16 if substancename == "HYDROMORPHONE HYDROCHLORIDE" & strengthunit == "mg/mL" & strengthnumber == "4"
* methadone
// replace mme = if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "g/g" & strengthnumber == "1"
replace mme = 30 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "10"
replace mme = 120 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "40"
replace mme = 15 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "5"
replace mme = 6 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/5mL" & strengthnumber == "10"
replace mme = 3 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/5mL" & strengthnumber == "5"
replace mme = 30 if substancename == "METHADONE HYDROCHLORIDE" & strengthunit == "mg/mL" & strengthnumber == "10"
* morphine
replace mme = 10 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "10"
replace mme = 100 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "100"
replace mme = 15 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "15"
replace mme = 20 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "20"
replace mme = 200 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "200"
replace mme = 30 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 5 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "5"
replace mme = 50 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "50"
replace mme = 60 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "60"
replace mme = 80 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/1" & strengthnumber == "80"
replace mme = 2 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/5mL" & strengthnumber == "10"
replace mme = 20 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/5mL" & strengthnumber == "100"
replace mme = 4 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/5mL" & strengthnumber == "20"
replace mme = 0.5 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "0.5"
replace mme = 1 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "1"
replace mme = 10 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "10"
replace mme = 2 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "2"
replace mme = 20 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "20"
replace mme = 25 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "25"
replace mme = 4 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "4"
replace mme = 5 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "5"
replace mme = 50 if substancename == "MORPHINE SULFATE" & strengthunit == "mg/mL" & strengthnumber == "50"
* oxycodone
replace mme = 15 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "10"
replace mme = 22.5 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "15"
replace mme = 45 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 7 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "4.8355"
replace mme = 60 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "40"
replace mme = 7.5 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "5"
replace mme = 11.3 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "7.5"
replace mme = 30 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/5mL" & strengthnumber == "100"
replace mme = 1.5 if substancename == "OXYCODONE HYDROCHLORIDE" & strengthunit == "mg/5mL" & strengthnumber == "5"
* oxymorphone
replace mme = 30 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "10"
replace mme = 45 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "15"
replace mme = 60 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "20"
replace mme = 90 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 120 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "40"
replace mme = 15 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "5"
replace mme = 22.5 if substancename == "OXYMORPHONE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "7.5"
* tramadol
replace mme = 10 if substancename == "TRAMADOL HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "100"
replace mme = 20 if substancename == "TRAMADOL HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "200"
replace mme = 30 if substancename == "TRAMADOL HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "300"
replace mme = 3.75 if substancename == "TRAMADOL HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "37.5"
replace mme = 5 if substancename == "TRAMADOL HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "50"
* Below here from the CDC source.
* butorphanol
replace mme = 0.7 if substancename == "BUTORPHANOL TARTRATE" & strengthunit == "mg/mL" & strengthnumber == "1"
replace mme = 7 if substancename == "BUTORPHANOL TARTRATE" & strengthunit == "mg/mL" & strengthnumber == "10"
replace mme = 1.4 if substancename == "BUTORPHANOL TARTRATE" & strengthunit == "mg/mL" & strengthnumber == "2"
* Meperidine
replace mme =5 if substancename == "MEPERIDINE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "50"
* opium
replace mme = 30 if substancename == "OPIUM" & strengthunit == "mg/1" & strengthnumber == "30"
replace mme = 30 if substancename == "OPIUM" & strengthunit == "mg/1" & strengthnumber == "60"
* pentazocine
replace mme = 18.5 if substancename == "PENTAZOCINE HYDROCHLORIDE" & strengthunit == "mg/1" & strengthnumber == "50"
save "${op_fp}mme_crosswalk.dta", replace
* ADD back the above:
use "/Users/austinbean/Desktop/programs/opioids/drug_characteristics.dta", clear
split substancename, p(";")
split strengthunit, p(";")
split strengthnumber, p(";")
rename substancename xsubsname
rename strengthnumber xstrengthnum
rename strengthunit xstrengthu
reshape long substancename strengthunit strengthnumber, i(ndc_code) j(sbctr)
drop if substancename == ""
replace substancename = strtrim(substancename) // a few codeine entries have a leading space.
replace strengthnumber = strtrim(strengthnumber) // more spaces
replace strengthunit = strtrim(strengthunit) // also
keep ndc_code ndccode sbctr ndc11code productndc xsubsname xstrengthnum xstrengthu substancename strengthunit strengthnumber
merge m:1 substancename strengthunit strengthnumber using "${op_fp}mme_crosswalk.dta"
drop _merge
local vars1 "codeine fentanyl hydrocodone hydromorphone methadone morphine oxycodone oxymorphone tramadol pentazocine opium meperidine butorphanol non_zero_mme mme"
foreach v of local vars1{
replace `v' = 0 if `v' == .
rename `v' `v'_
}
drop substancename strengthunit strengthnumber
sort ndc_code sbctr
reshape wide codeine fentanyl hydrocodone hydromorphone methadone morphine oxycodone oxymorphone tramadol pentazocine opium meperidine butorphanol non_zero_mme mme , i(ndc_code) j(sbctr)
foreach v of local vars1 {
di "`v'"
egen some_`v' = rowtotal(`v'_*)
drop `v'_*
rename some_`v' `v'
}
save "${op_fp}per_ndc_mme.dta", replace