Hello experts,
I am trying to measure the distance between locations but it returns null values, no error message. The XY coordinates were generated using ARCGIS projected coordinate system. I am using SAS 9.4. See below my codes and table. Thank you
/*Calculate the distance*/
data state.c000dist;
set state.c000_odxy;
format distance best12.;
distance=geodist(h_y, h_x, w_y, w_x);
run;
data state.c000dist;
set state.c000_odxy;
format distance best12.;
distance=geodist(h_y, h_x, dest_y, dest_x, 'M');
run;
w_1 | h_1 | h_x | h_y | w_x | w_y | distance |
295101011001003 | 291892204451015 | 1549820 | 3396739 | 737017.8 | 4270860 | |
295101011001003 | 295101011001003 | 1704594 | 3199620 | 737017.8 | 4270860 | |
295101011001003 | 291892202003011 | 1606500 | 3013045 | 737017.8 | 4270860 | |
295101011001003 | 290997002112025 | 1590932 | 3380332 | 737017.8 | 4270860 | |
295101011001003 | 290997001091013 | 1591513 | 3388368 | 737017.8 | 4270860 | |
295101011001003 | 295101063002004 | 1586158 | 3403888 | 737017.8 | 4270860 | |
295101011001003 | 290997014041047 | 1597463 | 3395733 | 737017.8 | 4270860 | |
295101011001003 | 171635040011097 | 1057384 | 3381480 | 737017.8 | 4270860 | |
295101011001025 | 295101021003001 | 1538631 | 3137542 | 737540 | 4270380 | |
295101011001025 | 295101011001025 | 1537792 | 3138305 | 737540 | 4270380 | |
295101011001025 | 295101021001013 | 1536083 | 3135691 | 737540 | 4270380 | |
295101011001025 | 171194034022007 | 1545883 | 3145134 | 737540 | 4270380 | |
295101011001025 | 290997014042011 | 1591510 | 3221054 | 737540 | 4270380 | |
295101011001026 | 291879507003038 | 1615559 | 2994634 | 737669.6 | 4270308 | |
295101011001026 | 190130007001013 | 1790677 | 2920093 | 737669.6 | 4270308 | |
295101011001026 | 295101105001027 | 1790300 | 2919619 | 737669.6 | 4270308 | |
295101011001026 | 291892126002008 | 1787475 | 2915743 | 737669.6 | 4270308 | |
295101011001026 | 291892126001005 | 1783127 | 2913354 | 737669.6 | 4270308 | |
295101011001029 | 291892199006006 | 1783154 | 2913153 | 736570.1 | 4270925 |
As @ChrisNZ already mentioned, the GEODIST function uses longitude and latitude, not projected coordinates. Projected coordinates are coordinates for a projection of the Earth sphere unto a flat surface. And there are a lot of different projection types (see https://resources.arcgis.com/en/help/main/10.1/018z/pdf/projected_coordinate_systems.pdf ). You will have to find a way to convert the projected coordinates to longitude and latitude in order to use GEODIST.
Which coordinates are you using?
The function geodist requires latitude and longitude coordinates.
Can you export that for ARCGIS?
As @ChrisNZ already mentioned, the GEODIST function uses longitude and latitude, not projected coordinates. Projected coordinates are coordinates for a projection of the Earth sphere unto a flat surface. And there are a lot of different projection types (see https://resources.arcgis.com/en/help/main/10.1/018z/pdf/projected_coordinate_systems.pdf ). You will have to find a way to convert the projected coordinates to longitude and latitude in order to use GEODIST.
Which coordinates are you using?
That's right. I converted to feet and then miles. Thank you.
I used the NAD_1983_UTM_Zone_15N
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.