BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
michokwu
Quartz | Level 8

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_1h_1h_xh_yw_xw_ydistance
29510101100100329189220445101515498203396739737017.84270860 
29510101100100329510101100100317045943199620737017.84270860 
29510101100100329189220200301116065003013045737017.84270860 
29510101100100329099700211202515909323380332737017.84270860 
29510101100100329099700109101315915133388368737017.84270860 
29510101100100329510106300200415861583403888737017.84270860 
29510101100100329099701404104715974633395733737017.84270860 
29510101100100317163504001109710573843381480737017.84270860 
295101011001025295101021003001153863131375427375404270380 
295101011001025295101011001025153779231383057375404270380 
295101011001025295101021001013153608331356917375404270380 
295101011001025171194034022007154588331451347375404270380 
295101011001025290997014042011159151032210547375404270380 
29510101100102629187950700303816155592994634737669.64270308 
29510101100102619013000700101317906772920093737669.64270308 
29510101100102629510110500102717903002919619737669.64270308 
29510101100102629189212600200817874752915743737669.64270308 
29510101100102629189212600100517831272913354737669.64270308 
29510101100102929189219900600617831542913153736570.14270925 
1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14

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?

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

The function geodist requires latitude and longitude coordinates.

Can you export that for ARCGIS?

michokwu
Quartz | Level 8
That's right. I converted to feet and then miles. Thank you
s_lassen
Meteorite | Level 14

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?

michokwu
Quartz | Level 8

That's right. I converted to feet and then miles. Thank you.

I used the NAD_1983_UTM_Zone_15N

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1792 views
  • 0 likes
  • 3 in conversation