1) Download drug and violence data for 1990, 2005, and 2010 from https://cloud.ihme.washington.edu/public.php?service=files&t=d559026958b38c3f4d12029b36d783da and run the following on the individual data sets:

drop causelevel1-causelevel4 nm* pc* rt_u rt_l region
keep if age_name=="All ages" & sex=="Both sexes" & measure=="death"
drop age_name sex measure

2) append the three drug datasets to one another, and the three violence datasets to one another

3) prepare for use with other data:

a) violence data:

replace causelevel5="firearmshooting" if causelevel5=="Assault by firearm"
replace causelevel5="IHMEviolentdeaths" if mi(causelevel5)==1
drop if causelevel5!="IHMEviolentdeaths" & causelevel5!="firearmshooting"
reshape wide rt_mean, i( country_name year) j( causelevel5) string
rename rt_mean* *
label var IHMEviolentdeaths "violent deaths per 100,000 (from IHME-GBD 2010)"
label var firearmshooting "violent deaths by firearm per 100,000 (from IHME-GBD 2010)"

b) drug data

replace causelevel5="IHMEdrugdeaths" if mi(causelevel5)==1
replace causelevel5="IHMEcocainedeaths" if causelevel5=="Cocaine use disorders"
replace causelevel5="IHMEamphetaminedeaths" if causelevel5=="Amphetamine use disorders"
replace causelevel5="IHMEopioiddeaths" if causelevel5=="Opioid use disorders"
replace causelevel5="IHMEotherdrugdeaths" if causelevel5=="Other drug use disorders"
reshape wide rt_mean, i( country_name year) j( causelevel5) string
rename rt_mean* *
label var IHMEdrugdeaths "drug deaths per 100,000 (from IHME-GBD 2010)"
label var IHMEcocainedeaths "cocaine deaths per 100,000 (from IHME-GBD 2010)"
label var IHMEamphetaminedeaths "amphetamine deaths per 100,000 (from IHME-GBD 2010)"
label var IHMEopioiddeaths "opiod deaths per 100,000 (from IHME-GBD 2010)"
label var IHMEotherdrugdeaths "drug deaths w/o coc, op, amph per 100,000 (from IHME-GBD 2010)"

4) merge drug & violence data 1:1 on country_name & year

5) merge m:1 with country code matchfile