Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Soundex. How to increase from three numbers to six numbers after the first letter

    The soundex command in Stata assigns a the first letter of the name in the variable with three numbers.
    For example,

    soundex("Ashcraft") = "A226"

    I just need to increase the number of three numbers after ''A'' to six numbers.

    Does anyone know how to increase it?

    Kind wishes,
    Carlos.

  • #2
    Well, in the old days, before soundex() was a normal Stata function, there was an -egen- function soundex(), which, I think, was written by Michael Blasnik. And egen code = soundex(string_var), length(your_choice) enabled you to control the length of the code generated. The default was length 4.

    But the old -egen- function is not part of modern Stata, having been replaced by the modern function that is used with -generate-, not -egen-.

    I think you can still download the -egen- version, called _gsoundex.ado at http://ideas.repec.org/c/boc/bocode/s420901.html. If so, just download it to C:\ado\plus\_ (or the equivalent place in your Mac or Unix setup) and you can then use the old -egen- version.
    Last edited by Clyde Schechter; 31 Aug 2014, 14:26. Reason: To credit Michael Blasnik for the -egen soundex()- function.

    Comment


    • #3
      Dear Clyde,
      It works perfectly,
      Thank you so much for all your help.
      Kind wishes,
      CARLOS

      Comment


      • #4
        cpineda_stata it's a bit late, but if you're using Stata 14 there are now some alternative phonetic string encoding options available from a package I just set up for testing/distribution:

        Code:
        net inst strutil, from("http://wbuchanan.github.io/StataStringUtilities/")
        It includes all of the phonetic string encoding algorithms (with the exception being the Soundex and Refined Soundex algorithms) implemented in the Apache Commons Codec library. Additionally, there is also a command in the package that provides several different string similarity/distance algorithms from a single interface (e.g., you can estimate several different distance/similarity metrics from a single command issued once instead of having to use several commands for each distance/similarity metric).

        Comment

        Working...
        X