BookmarkSubscribeRSS Feed
MarcTC
Obsidian | Level 7
Suppose I have a address dataset(addr_lst) which has 100,000 US addresses and the following fields: idx, address, city, state, zip, x, y.

I want to find the addresses within 30 miles radius of each address.

Here is my sql to do this:

proc sql;
create table addr_30m as
select a.idx,
b.idx as idx2,
geodist(a.y, a.x, b.y, b.x,'M') as dist
from addr_lst a, addr_lst b
where geodist(a.y, a.x, b.y, b.x, 'M')<=30
; quit;

It is very slow because it uses Cartesian product. Is there any better way to speed up the computation?
3 REPLIES 3
Doc_Duke
Rhodochrosite | Level 12
your less than or equal to sign chopped of most of your SQL and question.
chang_y_chung_hotmail_com
Obsidian | Level 7
...

> It is very slow because it uses Cartesian product. Is

> there any better way to speed up the computation?

...

See Howard Schreier's excellent NESUG 16 (2003) paper.
MarcTC
Obsidian | Level 7
"See Howard Schreier's excellent NESUG 16 (2003) paper. "

Thanks, Chung expert.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1061 views
  • 0 likes
  • 3 in conversation