My dataset has three columns. In column 1 I have county1 which is a set of a fixed number of counties ( 100) out of all the census counties. Column 3 is county2 which has all the counties from the census, unlike the county1 column. And, in column 2 I have the distance between the fixed number of counties in a column of county1 and all the counties from the census in county2.
My goal is to find the minimum distance of the unique county present in column 3 from any of the fixed counties in column 1.
Like in the 3rd and 4th line of data in the county2 column the county 10001 shows up twice and the minimum distance for that county is 30.357154190846018 from the county 10005 in the county1 column. County 12121 and 12125 also show up twice in county2 column.
I want my desired variable to show up that minimum distance for each unique county from the county2 column except for those counties which are present in county1 column ( 100 fixed counties in county1 column).
May I have some guidance how I can do it?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long county1 double mi_to_county long county2 10001 30.357154190846018 10005 10001 33.93271490946873 10003 10003 33.93271490946873 10001 10005 30.357154190846018 10001 12001 21.94139189527779 12007 12001 26.160991422024676 12125 12001 26.527847890310913 12041 12001 36.84643076250594 12019 12001 37.26131475453462 12075 12001 37.32388476194004 12107 12001 37.74940321571971 12083 12001 40.91842391588499 12023 12001 44.941311511693854 12003 12001 50.78094710678782 12029 12001 52.02776446747155 12121 12001 53.80338887869782 12067 12001 58.37400366291111 12017 12003 19.06133167684259 12125 12003 20.428353446347472 12023 12003 27.31084808096766 12007 12003 32.92368786810345 13049 12003 35.31646691638998 12019 12003 37.44802004706887 12089 12003 39.019664192183974 12031 12003 40.33782725115972 12047 12003 41.39883902283289 13101 12003 42.25346062002965 12121 12003 44.941311511693854 12001 12003 47.39732770502037 13065 12003 50.68954033379425 13299 12003 50.94956183265025 12041 12003 56.91760482788743 13039 end
0 Response to Finding minimum distance between counties
Post a Comment