Is this it?
---------------------------------------------------
*! soundex algorithm - vers 2.1 by M Blasnik 11oct2001
*! syntax: egen newvar=soundex(oldvar), [Length(int 4)]
program define _gsoundex
version 7.0
gettoken type 0 : 0
gettoken g 0 : 0
gettoken eqs 0 : 0
syntax varlist(max=1) [if] [in], [Length(integer 4) BY(string)]
if `"`by'"' != "" {
_egennoby soundex() `"`by'"'
}
marksample touse, strok
tempvar work res code vlen
quietly {
gen str1 `g'=substr(`varlist',1,1)
gen str1 `work'=""
gen str1 `code'=""
gen byte `vlen'=length(`varlist')
sum `vlen', meanonly
local maxvlen=r(max)
drop `vlen'
local codestr "BFPV####CGJKQSXZDT######L#######MN######R#######AEIOUWHY"
forvalues i=2/`maxvlen' {
replace `work'=upper(substr(`varlist',`i',1))
replace
`code'=string((int((index("`codestr'",`work')-1)/8)+1)*(index("`codestr'
",`work')!=0))
replace `g'=`g'+ `code' if `work'!="" & substr(`g',-1,1)!=`code'
& `code'>"0" & `code'<"8"
if `i'==2 {replace `g'=substr(`g',1,1) if
`work'==substr(`g',1,1)}
}
replace `g'=subinstr(`g',"7","",.)
replace `g'=substr(`g',1,`length')
replace `g'=`g'+substr("0000000000",1,`length'-length(`g'))
replace `g'="" if !`touse'
compress `g'
}
end
---------------------------------------------------
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael
Blasnik
Sent: Friday, October 28, 2005 10:27 AM
To: [email protected]
Subject: Re: st: Re: Finding "near"-matches
I wrote an egen extension for soundex coding and I think I posted it SSC
a
few years ago, but now I can't find it using search.
Michael Blasnik
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/