To perform geo near, we require latitude and longitude. For this do we use the coordinates information from the shapefile or create the centroids separately using the centroid command.? Over here I have used the latitudes and longitudes by using the centroid command.

Second, I am trying to perform geo near. I want to look at the border districts' effect (spillover effect) i.e I want to find the non-treated neighboring districts for my treated districts. However, the treatment of the district varies over time. In other words, districts come in for treatment and go out over time. Now, I have got two datasets with the centroid values - one includes only treated districts and the other non-treated districts. After which I perform the geo near using the following codes with 2000 km?

geonear district x_stub y_stub using "Non- treated districts with centroids.dta", n(district1 x_stub1 y_stub1) ign long within(2000) near(2)

However, I am getting the following syntax.

nbor latitude var x_stub1 must be between -90 and 90
r(198);

Can anybody please help with these concerns?