Dear Stata Users,
I am interested in using a geographic regression discontinuity design where there is a discontinuity at a U.S. state border. My problem is that I do not know how to calculate the shortest distance from a point to a polygon. In ArcGIS, I see that there is a tool called “Near” that can determine the distance from a point to the nearest point on a polygon – this is exactly what I would like to do, however I cannot use ArcGIS and need to do the task in Stata (or SAS).
After much searching, I have not found a similar function in Stata to the ArcGIS “Near” function. I have seen the nearest.ado function, which is an efficient way to calculate the nearest point to another given a set of points. I need to calculate the distance to the border of just one state, so it might be very feasible to create a set of points that are on the border of this state (say a point at each half-mile along the border) and use nearest.ado to find the nearest border point to each non-border point. Is there a way to take a shapefile (e.g., the Census TIGER/Line state shapefile) and create dataset with the set of points along the border of a state?
Any other suggestions on how to calculate the distance from a point to a border?
Many thanks for your help!
Sincerely,
Jason
I am interested in using a geographic regression discontinuity design where there is a discontinuity at a U.S. state border. My problem is that I do not know how to calculate the shortest distance from a point to a polygon. In ArcGIS, I see that there is a tool called “Near” that can determine the distance from a point to the nearest point on a polygon – this is exactly what I would like to do, however I cannot use ArcGIS and need to do the task in Stata (or SAS).
After much searching, I have not found a similar function in Stata to the ArcGIS “Near” function. I have seen the nearest.ado function, which is an efficient way to calculate the nearest point to another given a set of points. I need to calculate the distance to the border of just one state, so it might be very feasible to create a set of points that are on the border of this state (say a point at each half-mile along the border) and use nearest.ado to find the nearest border point to each non-border point. Is there a way to take a shapefile (e.g., the Census TIGER/Line state shapefile) and create dataset with the set of points along the border of a state?
Any other suggestions on how to calculate the distance from a point to a border?
Many thanks for your help!
Sincerely,
Jason
Comment