I am unsure atm whether having the field be set as a number would cause the problem. Why not set the SSN to be a text field with an SSN input mask?
What determines whether the SSN is valid or not? Does the table currently have a bunch of SSNs and they are typed in random ways, or what is causing you to need to generate something like this?
Understanding this would help to determine what your condition needs to be.