Hi Statalist Community,
I have to compute the distance between centroids for some municipalities in my sample. But it is the first time that I am doing this, and I do not know how to compute the Harversine formula.
Basically, I want to create a dataset and keep municipalities that are betweeen 50 and 200 kilometres from key municipalities that I have in my sample.
Here is a -dataex-:
For example, let say that I am interested in centroid distance between "Amurrio" and the other municipalities.
Best,
Michael
I have to compute the distance between centroids for some municipalities in my sample. But it is the first time that I am doing this, and I do not know how to compute the Harversine formula.
Basically, I want to create a dataset and keep municipalities that are betweeen 50 and 200 kilometres from key municipalities that I have in my sample.
Here is a -dataex-:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float cmunine str47 munname double(lat lon) 1001 "Alegría-Dulantzi" 42.83981158 -2.51243731 1002 "Amurrio" 43.05427776 -3.00007326 1003 "Aramaio" 43.05119653 -2.56540037 1004 "Artziniega" 43.12084358 -3.12791718 1006 "Armiñón" 42.72326199 -2.87183475 1008 "Arratzua-Ubarrundia" 42.89116171 -2.63878816 1009 "Asparrena" 42.88968768 -2.31670754 1010 "Ayala/Aiara" 43.07768283 -3.04306746 1011 "Baños de Ebro/Mañueta" 42.52925602 -2.67863583 1013 "Barrundia" 42.91537538 -2.49407452 end
- How could I compute the Harversine formula and compute the distance in stata? Is there any command that allows me to do that, please?
Best,
Michael
Comment