Attachments provided to compare maps that exclude and include Alaska and Hawaii.
I am having trouble using spmap to create a map that displays Alaska and Hawaii next to the contiguous United States. When I execute my do file that excludes Alaska and Hawaii, the map is not distorted. However, when I revise the code to include Alaska and Hawaii, the map that displays all states looks very distorted.
I provided my Stata code that was used to generate the map without Alaska and Hawaii. How can I revise this code to generate a map that is not distorted and includes Alaska and Hawaii?
I am having trouble using spmap to create a map that displays Alaska and Hawaii next to the contiguous United States. When I execute my do file that excludes Alaska and Hawaii, the map is not distorted. However, when I revise the code to include Alaska and Hawaii, the map that displays all states looks very distorted.
I provided my Stata code that was used to generate the map without Alaska and Hawaii. How can I revise this code to generate a map that is not distorted and includes Alaska and Hawaii?
Code:
************************************************************************; *Read in the data; *Note: the master dataset excludes Puerto Rico; ************************************************************************; tempfile tf; use `moddata'master,clear; collapse (max) ME controls_noprior controls_prior ,by(state); gen coverage=1 if ME==1; replace coverage=2 if controls_noprior==1; replace coverage=3 if controls_prior==1; rename state stname; save `tf', replace; ************************************************************************; *TRANSLATE SHAPE FILES INTO .DTA; ************************************************************************; cd `mapdata'; shp2dta using gz_2010_us_040_00_20m, database(states-d) coordinates(states-c) genid(_ID) replace; use states-c; joinby _ID using states-d; drop if NAME=="Hawaii" | NAME=="Alaska" | NAME=="Puerto Rico"; rename NAME stname; save states-c, replace; use states-d, clear; rename NAME stname; joinby stname using `tf', unmatched(both); tab stname if _merge!=3; drop if _merge!=3; drop _merge; drop if stname=="Hawaii" | stname=="Alaska"; ************************************************************************; *SPMAP; ************************************************************************; local mapvar="coverage"; spmap `mapvar' using states-c, freestyle aspect(0.5, placement(north)) id(_ID) clmethod(unique) fcolor(gs5 gs16 gs12) yscale(off) xscale(off) ylabel(minmax, nogrid nolabels) xlabel(minmax, nogrid nolabels) plotregion(color(white)) graphregion(color(white)) legend(size(*1.45) ring(1) position(6) label(2 "Medicaid Expansion States (N=30)") label(3 "Non-Expansion States with No Prior Coverage (N=15)") label(4 "Non-Expansion States with Prior Coverage (N=6)") ); graph export "`latex'map_v3.png", replace;
Comment