Available Languages: reporting, Maintain
The SOUNDEX function analyzes a character string phonetically, without regard to spelling. It converts character strings to four character codes. The first character must be the first character in the string. The last three characters represent the next three significant sounds in the source string.
To conduct a phonetic search, do the following:
SOUNDEX(length, source_string, output)
Is the number of characters in source_string, or a field that contains the length. It can be a number enclosed in single quotation marks, or a field containing the number. The number must be from 01 to 99, expressed with two digits (for example '01'); a number larger than 99 causes the function to return asterisks (*) as output.
Is the string to analyze enclosed in single quotation marks, or a field or variable that contains the character string.
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.
The following request creates three fields:
The WHERE criteria selects the last name that matches your best guess.
DEFINE FILE EMPLOYEE PHON_NAME/A4 = SOUNDEX('15', LAST_NAME, PHON_NAME); PHON_COY/A4 WITH LAST_NAME = SOUNDEX('15', 'MICOY', PHON_COY); PHON_MATCH/A3 = IF PHON_NAME IS PHON_COY THEN 'YES' ELSE 'NO'; END
TABLE FILE EMPLOYEE PRINT LAST_NAME IF PHON_MATCH IS 'YES' END
The output is:
LAST_NAME --------- MCCOY