Hi Everyone,
I am using the 2015-16 wave of the Demographic and health survey from India, it contains data on reproductive behaviour and contraception. And I wanted to plot contraceptive use over the Indian states, to see if there is any pattern. I am very new to using maps in Stata so I am super confused on some of the steps. I followed the instructions given here and downloaded .dbg, shp, and .shx files as recommended by the tutorial from this website.
However given that it is a survey data i get the following error message:
Do I collapse the contuse variable to get means by state and then merge before trying to run the spmap command? This would make sure that the variable state is not repeating. I am not entirely sure what my next step should be.
Thanks in advance for the help
I am using the 2015-16 wave of the Demographic and health survey from India, it contains data on reproductive behaviour and contraception. And I wanted to plot contraceptive use over the Indian states, to see if there is any pattern. I am very new to using maps in Stata so I am super confused on some of the steps. I followed the instructions given here and downloaded .dbg, shp, and .shx files as recommended by the tutorial from this website.
Code:
shp2dta using IND_adm1, database(indb) coordinates(incoord) genid(id) // create dta files for database and coordinates use indb, clear desc list ID_1 NAME_1 in 1/5 list ID_1 NAME_1 ren ID_1 state save "C:/Users/lori/Dropbox/workable_idata/cleaning/indb_shape.dta" use "C:/Users/lori/Dropbox/workable_idata/cleaning/indiv_1516_append.dta", clear encode sv024, gen(state) merge m:1 state using indb_shape / used m:1 merge since master file has many individuals from the same state *creating a contraceptive use dummy using the contraceptive use_pattern variable tab use_pattern gen contuse = 1 if use_pattern == 1 replace contuse = 0 if use_pattern != 1 tab contuse // this is a dummy that indicates contraceptive use based on the pattern of use (use_pattern) variable spmap contuse using incoord if id !=1 & id!=19, id(id) fcolor(Blues)
Code:
Variable id specified in option id() does not uniquely identify the observations r(459);
Thanks in advance for the help