I hope there is someone that will be able to help me. I have been looking at previous FAQ on Statalist but could not find the one that will give me the code I need.
I have two datasets. In the first dataset I have 60 obs of small gold mines in Burkina Faso. I have the longitude and latitude of each mine. It is just a point, not a polygon. So the database looks something like this: (The "objectid" is just each mine numbered and the longitude and latitude is the specific mine's coordinates.)
| objectid longitude latitude |
|--------------------------------------------|
| 1 12.019287 1.3967028 |
| 2 12.471074 .76883174 |
| 3 13.353399 -.29639484 |
| 4 12.411368 -.72431002 |
| 5 12.246743 -.87246019 |
In the second database I use data from the DHS survey from USAID - I have more than 25000 observations of households in Burkina Faso. With variables that describe the household (wealth, if they have electricity, literacy, etc) as well as the longitude and latitude of the village the household is in. It looks something like this:
id longit~e latitude wealth~x litera~y |
|-------------------------------------------------------------------|
| 517 -4.307324 11.18618 richest able to |
| 164 -2.36086 13.205 richer cannot r |
| 200 -5.289879 10.70456 poorest cannot r |
| 349 0.304598 13.81315 poorest cannot r |
| 173 -4.324343 9.669069 richest cannot r |
My question:
I want to create a dummy variable in my second database called vicinity_mine that is 1 if the household's village (longitude and latitude attached to the household) is in the vicinity of a mine and 0 if not. Let's say "vicinity" is defined as within a 5km radius of the mine. I want to use the coordinates of the mines in the first database to create such a database but I am not sure where to start.
I have very little experience with distances and using coordinates on Stata so any help on what code I should use will be very helpful.
Thank you very much.
All the bet,
Nettie
Related Posts with What code will match longitude and latitudes
How do I expand period data into data by year?Hello, relatively new user here, using stata for my university class and have a base level proficien…
Adding lines at 95% CI to kdensity plotHi all, I want to add red lines at the 95% confidence interval (one on each side) in this kdensity …
Disable variable expansionHi, it happens the following, I write for example: Code: use "db.dta" [...] gen year = start + de…
Difference in difference analysis, defining treatment and control groupsI want to run a difference in differences design. I have a balanced panel of individuals across 10 …
Save results of estat ptrends to fileHow can I save the result of `estat ptrends` and `estat granger` to file? I have tried with etable, …
Subscribe to:
Post Comments (Atom)
0 Response to What code will match longitude and latitudes
Post a Comment