Hi, I'm very new to stata and I'm struggling to make a map.
the code i've made is this:
ssc install spmap
ssc install shp2dta
ssc install mif2dta
cd "/Users/joseph/Documents/Econometrics/Stata data"
shp2dta using Municipios_2009, database(mexdb) coordinates(mexcoord) genid(id)
use mexdb.dta
describe
gen loc_code= CVE_ENT+ CVE_MUN
destring loc_code, replace
merge 1:1 loc_code using "totalhomicides.dta"
drop merge
spmap totalhomicides using mexcoord, id(id) fcolor(Blues)
everything is fine until i get to "merge 1:1 loc_code using "totalhomicides.dta" then it says that the variable "loc_code" can't be found even though i thought i've just generated it.
Any help would be really appreciated sorry if this is a bad question i'm really new to stata and dont know what Ive done wrong.
Thank you
the code i've made is this:
ssc install spmap
ssc install shp2dta
ssc install mif2dta
cd "/Users/joseph/Documents/Econometrics/Stata data"
shp2dta using Municipios_2009, database(mexdb) coordinates(mexcoord) genid(id)
use mexdb.dta
describe
gen loc_code= CVE_ENT+ CVE_MUN
destring loc_code, replace
merge 1:1 loc_code using "totalhomicides.dta"
drop merge
spmap totalhomicides using mexcoord, id(id) fcolor(Blues)
everything is fine until i get to "merge 1:1 loc_code using "totalhomicides.dta" then it says that the variable "loc_code" can't be found even though i thought i've just generated it.
Any help would be really appreciated sorry if this is a bad question i'm really new to stata and dont know what Ive done wrong.
Thank you

Comment