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

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.

 

 

 

 

1 ACCEPTED SOLUTION
5 REPLIES 5
Reeza
Super User

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.

Jse
Fluorite | Level 6 Jse
Fluorite | Level 6

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.  

 

 

 

Jse
Fluorite | Level 6 Jse
Fluorite | Level 6

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.

Reeza
Super User
Without a log or any sample data I can't say...

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1282 views
  • 2 likes
  • 2 in conversation