Hi,
I have two datasets and would need to work with them simultaneously. The first dataset has the coordinates of the center of grid cells (let's call them "stations"), and the latitude and longitude of the surrounding border of the grid cells. The second dataset (shown on the right) has the coordinates of households (call them "households").
The first dataset is much bigger than the second one, and I would now like to only keep those stations that have at least one household in their grid. I thought, if I could relate these datasets, I could tell Stata to only keep those stations for which a household falls inside their grid. I managed to do it on QGIS, but I wondered if it is also possible to do it on Stata.
"Stations" dataset:
"Household" dataset:
For visualization, this is how it looks like on QGIS: i.e., I'd like to keep only those green points (stations) that have a household in their cell (here, all these cells are already marked in orange).

Does anyone know whether it's possible to do that in Stata, and if yes, how to do it?
Thank you!
I have two datasets and would need to work with them simultaneously. The first dataset has the coordinates of the center of grid cells (let's call them "stations"), and the latitude and longitude of the surrounding border of the grid cells. The second dataset (shown on the right) has the coordinates of households (call them "households").
The first dataset is much bigger than the second one, and I would now like to only keep those stations that have at least one household in their grid. I thought, if I could relate these datasets, I could tell Stata to only keep those stations for which a household falls inside their grid. I managed to do it on QGIS, but I wondered if it is also possible to do it on Stata.
"Stations" dataset:
Code:
input long v1 float(lat_center lon_center lat_south lat_north lon_west lon_east) 4018224 37.958332 -24.958334 37.875 38.041664 -25.04167 -24.875 4018225 37.875 -24.958334 37.791668 37.958332 -25.04167 -24.875 4018226 37.791668 -24.958334 37.708336 37.875 -25.04167 -24.875 4018227 37.708332 -24.958334 37.625 37.791664 -25.04167 -24.875 4018228 37.625 -24.958334 37.541668 37.708332 -25.04167 -24.875 4018229 37.541668 -24.958334 37.458336 37.625 -25.04167 -24.875 4018230 37.458332 -24.958334 37.375 37.541664 -25.04167 -24.875 4018231 37.375 -24.958334 37.291668 37.458332 -25.04167 -24.875 4018232 37.291668 -24.958334 37.208336 37.375 -25.04167 -24.875 4018233 37.208332 -24.958334 37.125 37.291664 -25.04167 -24.875
Code:
input float uniquecluster double(lat_household lon_household) 1 -12.169283 13.859255 2 -12.167753 13.845458 3 -12.747312 13.607121 4 -11.502919 14.060841 5 -13.130185 13.109428 6 -12.42766 13.573896 7 -13.435833 14.287285 8 -12.3617 14.778201 9 -10.827451 14.342114 10 -9.991311 14.898295
Does anyone know whether it's possible to do that in Stata, and if yes, how to do it?
Thank you!

Comment