Date: Thu, 6 Mar 2003 03:03:35 GMT
Reply-To: julierog@ix.netcom.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roger Lustig <trovato@BELLATLANTIC.NET>
Subject: Re: Address match
Content-Type: text/plain; charset=us-ascii; format=flowed
Dear Chandra:
Try this.
***** Add a sequence number within each ID group;
***** Assume that BASE is sorted by ID already;
data numbered;
do seq=1 by 1 until (last.id);
set base;
output;
end;
run;
***** Compare each to each within ID groups;
proc sql;
create table compared as
select
a.*,
b.b_seq,
b.b_address,
/* SPEDIS is not symmetrical. */
/* Try different metrics depending on your problem. */
spedis(a.a_address,b.b_address) as spedis_ab,
spedis(b.b_address,a.a_address) as spedis_ba
/*Insert other variables of your choice here */
from
numbered a (rename=(address=a_address seq=a_seq)),
numbered b (rename=(address=b_address seq=b_seq))
where a.id=b.id
and
/* Eliminate duplication */
a.a_seq < b.b_seq
/* Any other ordering would do fine too */
order by a.id,max(spedis_ab,spedis_ba)
;
quit;
proc print noobs;
by ID;
run;
Best,
Roger Lustig
chandra kalisetty wrote:
> Hello All
>
> I am trying to da an address match on my data. My data looks as follows.
>
> id address
> 1 123 main street
> 1 123 main street
> 1 23 state street
> 2 345 south blvd
> 2 78 north street
> 3 89 royal drive
> 3 89 royal drive
>
> I want to compare the address with in the same id. The problem is hw can I
> compare first address with the second address. How can I look at the second
> address. Can I use arrays? also I don't know how many addreses are there
> for
> the same ID. To compare addresses I can use "SPEDIS" function. But, How to
> lok at the second observation.
>
> Any help is greatly appreciated
> Thanks
> Sekhar
>
>
>
> _________________________________________________________________
> Cricket World Cup 2003- News, Views and Match Reports.
> http://server1.msn.co.in/msnspecials/worldcup03/
|