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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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