5 users online | 5 Guests and 0 Registered

How does the 'SOUNDS LIKE' (=*) operator work in a WHERE statement?


The SOUNDS LIKE (=*) operator uses a soundex algorithm to simplify a word for comparison purposes.  The algorithm is predicated on English however, and is less accurate for other languages.

Firstly retain the first letter and discard the following letters:  A E H I O U W Y

Secondly, substitute the numbers as follows to the letter groupingss:

  1. B F P V
  2. C G J K Q S X Z
  3. D T
  4. L
  5. M N
  6. R

finally, if two or more adjacent letters (prior to discarding letters) have the same number classification resulting from the second step, then de-duplicate.

The same logic is used by the SOUNDEX function, e.g.:

data al ;
  length name name_sound $ 10 ;
  name = 'Alan' ;
  name_sound = soundex(name) ;
  output ;
  name = 'alun' ;
  name_sound = soundex(name) ;
  output ;
  name = 'ALLAN' ;
  name_sound = soundex(name) ;
  output ;
  name = 'Allen' ;
  name_sound = soundex(name) ;
  output ;
  name = 'Alyn' ;
  name_sound = soundex(name) ;
  output ;
  name = 'Alwyn' ;
  name_sound = soundex(name) ;
  output ;
  name = 'David' ;
  name_sound = soundex(name) ;
  output ;
run ;

data soundslike ;
  set al ;
    where name =* 'ALAN' ;
run ;

Note that both the SOUNDEX function and the SOUNDS LIKE (=*) operator are case-insensitive!

Tags: =*, SOUNDEX, SOUNDS LIKE
Author:
Alan D Rudland
Revision:
1.1
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags