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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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