-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunits_measurement.do
62 lines (45 loc) · 2.09 KB
/
units_measurement.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
* units of measurement.
* TODO - fentanyl patches to mg/l and/or MME
global op_fp "/Users/austinbean/Google Drive/Current Projects/HCCI Opioids/"
global op_pr "/Users/austinbean/Desktop/programs/opioids/"
use "${op_pr}drug_characteristics.dta", clear
merge 1:1 ndc_code using "${op_pr}mme_by_ndc.dta"
drop if _merge ==2
drop _merge
keep strengthunit ndccode ndc11code productndc ndc_code NDC_Numeric querycode
split strengthunit, p(";")
drop strengthunit
reshape long strengthunit, i(ndc_code) j(strct)
drop if strengthunit == ""
drop strct NDC_Numeric
replace strengthunit = strtrim(strengthunit)
gen conversion_factor = .
* nearly everything is mg/l
replace conversion_factor = 1000 if strengthunit == "mg/mL"
replace conversion_factor = 800 if strengthunit == "mg/1.25mL"
replace conversion_factor = 500 if strengthunit == "mg/2mL"
replace conversion_factor = 400 if strengthunit == "mg/2.5mL"
replace conversion_factor = 333.33 if strengthunit == "mg/3mL"
replace conversion_factor = 200 if strengthunit == "mg/5mL"
replace conversion_factor = 100 if strengthunit == "mg/10mL"
replace conversion_factor = 66.66 if strengthunit == "mg/15mL"
replace conversion_factor = 50 if strengthunit == "mg/20mL"
replace conversion_factor = 20 if strengthunit == "mg/50mL"
replace conversion_factor = 1 if strengthunit == "mg/1" // nothing to convert.
replace conversion_factor = 1 if strengthunit == "ug/mL" // nothing to convert.
replace conversion_factor = 0.001 if strengthunit == "ug/1"
duplicates drop ndc_code, force
save "${op_fp}units_measurement.dta", replace
/*
not easily converted =:
------------+-----------------------------------
* solids?
g/100g | 4 0.29 0.29
g/g | 1 0.07 0.37
mg/g | 6 0.44 87.77
* fentanyl patches do have MME. See footnote 8 of:
https://www.cms.gov/Medicare/Prescription-Drug-Coverage/PrescriptionDrugCovContra/Downloads/Opioid-Morphine-EQ-Conversion-Factors-April-2017.pdf
* hourly:
ug/h | 34 2.49 99.27
------------+-----------------------------------
*/