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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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