Help using Base SAS procedures

geodist and cross join help

Accepted Solution Solved
Reply
Occasional Contributor Jse
Occasional Contributor
Posts: 17
Accepted Solution

geodist and cross join help

[ Edited ]

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.

 

 

 

 


Accepted Solutions
Solution
‎11-13-2015 06:11 PM
Super User
Posts: 19,767

All Replies
Super User
Posts: 19,767

Re: geodist and cross join help

[ Edited ]

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.

Occasional Contributor Jse
Occasional Contributor
Posts: 17

Re: geodist and cross join help

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.  

 

 

 

Solution
‎11-13-2015 06:11 PM
Super User
Posts: 19,767

Re: geodist and cross join help

Occasional Contributor Jse
Occasional Contributor
Posts: 17

Re: geodist and cross join help

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.

Super User
Posts: 19,767

Re: geodist and cross join help

Without a log or any sample data I can't say...
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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