*! version 1.0 11/11/2014 Adrian Sayers
help nysiis

Title

nysiis -- Calculate the nysiis phonetic code.

Syntax

nysiis
1
[, generate(newvar)
noisily ]

Description

nysiis calculates the NYSIIS phonetic code of a string variable according to the algorithm described by Taft 1970.

There are number of different variants of the algorithm hosted on websites. However, the most complete description i have found is in:

"Data Quality and Record Linkage Techniques" Herzog T.N., Scheuren F.J., Winkler W.E. 2007 pg 119-121.

I have never seen the originally described algorithm. The majority of the discrepancies between algorithms occur in the iterative process in step 5, see below.

The algorithm consists of 7 Steps. In the first step, the initial letter(s) of a surname are examined and altered as necessary. In the second step, the same is done for the last letter(s) of the surname. In Step 3, the first
letter of the NYSIIS coded surname is established. Steps 5 and 6 constitute an iterative procedure for creating the remaining letters of the NYSIIS-coded surname. In this iterative scheme, we begin with the second letter of the altered
surname and scan each letter of the remaining letters of the surname using an imaginary pointer. In Step 5, one or more of the letters of the coded surname are established via a set of rules. The rules are reapplied each time
the pointer is moved to the next letter of the name. In Step 7, the end portion of the NYSIIS code just created is subjected to a further check and changed as necessary.

nysiis accepts one arguments, which must be a string variable. Cases are lowered within the algorithm.

The nysiis phoenetic code is returned as a new variable with default name nysiis.

Algorithm

Step 1: Change the initial letter(s) of the surname as indicated (mac->mcc) (kn->nn) (k->c) (ph->ff) (pf->ff) (sch->sss).

Step 2: Change the last letter(s) of the surname as indicated (ee->y) (ie->y) (dt->d) (rt->d) (rd->d) (nt->d) (nd->d).

Step 3: The first character of the NYSIIS-coded surname is the first letter of the (possibly altered) surname.

Step 4: Position the pointer at the second letter of the (possibly altered) surname.

Step 5: (Change the current letter(s) of the surname  i.e., the one at the present position of the pointer.) Execute exactly one of the following operations, proceeding from top to bottom:

(a) If blank, go to Step 7.

(b) If the current letter is E and the next letter is V, then change EV to AF.

(c) Change a vowel (AEIOU) to A.

(d) Change Q to G.

(e) Change Z to S.

(f) Change M to N.

(g) If the current letter is the letter K, then change K to C unless the next letter is N. If K is followed by N, then replace KN by N.

(h) Change SCH to SSS.

(i) Change PH to FF.

(j) If H is preceded by or followed by a letter that is not a vowel (AEIOU), then replace the current letter in the surname by the preceding letter.

(k) If "W" is preceded by a vowel, then replace the current letter in the surname with the preceding letter.

Step 6: The next character of the NYSIIS code is the current position letter in the surname after completing Step 5 (but omitting a letter that is equal to the last character already placed in the code). After putting a character into the code, move the pointer forward to the next letter of the surname. Then return to Step 5.

Step 7: (Change the last character(s) of the NYSIIS-coded surname.) If the last two characters of the NYSIIS-coded surname are AY, then replace AY by Y. If the last character of the NYSIIS-coded surname is either S or A, then delete it.

Options

generate(newvar) Create a new variable named newvar containing the NYSIIS phoentic code. If the generate() option is not used, a new variable will be created with default name nysiis.

noisily Switches on a timer and displays the position in the algorithm, probably only useful in very large files.

Examples

sysuse nysiis_names ,clear

nysiis name , gen(nysiis_code) noisily

list name nysiis_code

Saved results

nysiis saves the following in r():

Macros

r(nysiis) name of new string variable if created

Disclaimer

nysiis comes with no warranty intended or implied. We recommend that users check their results with those obtained through other algorithms. Users are also encouraged to check their results with those produced by other statistical software or name coding packages.

Reference

"Data Quality and Record Linkage Techniques", Herzog T.N., Scheuren F.J., Winkler W.E. 2007 pg 119-121.

"Name Search Techniques", Taft RL., New York State Identification and Intelligence System, Special Report No. 1, Albany, New York, 1970.

Author

Adrian Sayers

University of Bristol

adrian.sayers@bristol.ac.uk

Acknowledgement

Matthew Curtis mjdcurtis@gmail.com spotted and fixed unusual behaviour in how steps 5j and 5k are implmented 07/2018

Also see

strdist, soundex, jarowinkler