Hi All,
Could you please help if there a SAS code to exactly replicate the GEODIST function?
I want to calculate the distance using latitudes and longitudes but it should exactly replicate the outcome of GEODIST function for the same input of latitudes and longitudes.
For ex:
If Distance = geodist(32.5153, -92.1567, 32.53238, -92.07976, 'DM'); is giving 4.6443116482
I want to calculate it manually to get the same value 4.6443116482.
Thanks a lot.
Hi All,
Could you please help if there a SAS code to exactly replicate the GEODIST function?
I want to calculate the distance using latitudes and longitudes but it should exactly replicate the outcome of GEODIST function for the same input of latitudes and longitudes.
Thanks a lot.
Do you mean manual code? ie
( x**2 + y **2 ) ^ 1/2 .....
Because SAS has a GEODIST function so I'm confused....
For ex:
If Distance = geodist(32.5153, -92.1567, 32.53238, -92.07976, 'DM'); is giving 4.6443116482
I want to calculate it manually to get the same value 4.6443116482.
Out of curiousity, why?
I need to work and explain non-SAS user how I'm coming up with that (GEODIST) value.
Note that I've merged this into one thread since it's the exact same question.
This might be more difficult than you expect. SAS doesn't use the simple great circle distance formulas that you can find on Wikipedia. They are calculating the distance on some ellipsoid approximating the shape of the Earth. You can look at the reference that they give here.
https://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
Before GEODIST() there was a %geodist macro. You can find it via Google, it's relatively close but not exact to the numbers from GEODIST().
Thanks, PG. Appreciate the information.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.