Hello,
I have a data set with 500k members (by memid) and lat and lon in degrees, and a data set with 300 providers (by prov) with lat and lon in degrees. Both are geocoded at the street address level.
data member_geo; set work.geocoded_mems (rename=(X=LA1 y=LO1)); run;
data prov_geo; set work.geocoded_provs (rename=(X=LA2 Y=LO2)); run;
I want to calculate distances between member to providers using geodist.
geodist(LA1,LO1,LA2,LO2,'M')
Can someone help me find the appropriate cross join and distance calculation?
Thank you very much.
You say by zipcode, but then refer to lat/long? Which are you using?
It may be better, and more efficient, to do it at the zipcode level and then merge it back to the provider level.
If you want code, it helps if you post some sample data. You could use the zipcode table to generate random data.
Hello, sorry for being unclear.
I have geocoded members and providers at the street address level.
I would like to calculate the distances from patients to providers in miles.
Thank you for the example Reza.
data member_geo; set work.geocoded_mems (rename=(X=LA1 Y=LO1)); run;
data prov_geo; set work.geocoded_provs (rename=(X=LA2 Y=LO2)); run;
proc sql;
create table geo_join as
select a.LA1, a.LO1, a.memid, a.zip, b.LA2, b.LO2, b.prov,
geodist(a.LA1, a.LO1, b.LA2, b.LO2,'m') as geodist
from member_geo a, prov_geo b;
quit;
This is my code, but i am getting null values for geodist.
Any idea why? I have lat and lon in degrees in both sets.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.