Programming the statistical procedures from SAS

Asking Advices regarding SAS GEOdist Function

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

Asking Advices regarding SAS GEOdist Function

SAS Q.png


Accepted Solutions
Solution
‎07-17-2014 10:22 AM
Grand Advisor
Posts: 9,475

Re: Asking Advices regarding SAS GEOdist Function

SQL + geodis()  -- sorry I have forgetton. You need check documentation. Here is dummy code.

proc sql;

create table distance as

select a.* ,b.id as _id, geodis(.......)  as distance

  from have a, have b;

quit;

after that you need transpose your table distance to get final output.

Xia Keshan

View solution in original post


All Replies
Solution
‎07-17-2014 10:22 AM
Grand Advisor
Posts: 9,475

Re: Asking Advices regarding SAS GEOdist Function

SQL + geodis()  -- sorry I have forgetton. You need check documentation. Here is dummy code.

proc sql;

create table distance as

select a.* ,b.id as _id, geodis(.......)  as distance

  from have a, have b;

quit;

after that you need transpose your table distance to get final output.

Xia Keshan

Grand Advisor
Posts: 10,081

Re: Asking Advices regarding SAS GEOdist Function

Syntaxt for

GEODIST(latitude-1, longitude-1, latitude-2, longitude-2 <,options>)

so use Ksharps code and bring in the b version of lat and long :

add to the select statement

b.longitude as blong, b.latitude as blat, geodist (latitude, longitude, blat, blong) as distance

you may likely want the store from the b data set as well so you know which distance which would bring up b.id as bstore in the select as well.

Occasional Contributor
Posts: 16

Re: Asking Advices regarding SAS GEOdist Function

Thanks to all. I finally found 'how to'.

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 410 views
  • 3 likes
  • 3 in conversation