2 Replies Latest reply: May 15, 2014 10:07 AM by elginreigner _ RSS

    Social Security Numbers - Leading Zeros

    elginreigner _

      i am a programmer at heart, most of my filters/fields have hardcore code in them, one of them being a social security to verify everything about it, including the leading zeros.


      There may be other ways to approach this, but I really liked this way and thought I would share. Normally I test the lenght of the field and add the appropriate number of zeros. Well this does that very simply in much less lines.




      As you see, i add 9 leading zeros and extract the right 9 digits is the resulting SSN.

        • Social Security Numbers - Leading Zeros
          Olly Bond

          Hello Elginreigner,


          There's another way to get the same effect using the STR() function in Monarch, which allows you to specify the length of a string and the fill character.




          will return a nine character string stuffed with as many leading zeroes as necessary.


          Also, since Monarch v9 (I think), but certainly since v10, there are helpful user defined functions pre-built into Monarch which allow you to work with many common numeric codes.


          There's a function called "Check_SSN" which might be helpful: "Performs very simple US Social Security Number verification on a character string representing the SSN.  Returns 1 if the number is valid, otherwise returns 0.  NOTE, this should only be used as a mechanism for assisting in trapping simple data entry errors, not as a validation technique to avoid fraud.  Official tools for employers are available at www.socialsecurity.gov/employer/ssnv.htm"


          To access the UDFs, click on the [I]f(x)[/I][/B] icon on the toolbar, from within the table window, and select "import". The functions are available in a model called UserDefinedFunctions.xmod which should be installed in the default models folder.