09-09-2014 10:41 AM
I am working on a snippet where I am formatting SSN. In the past, the Z format worked, but it has not worked lately. I tried using picture (for example, picture ssfmt other = '999999999', but that hasn't worked as well. I am getting an error that states that the format was not found or could not be loaded.
picture ssfmt low-high = '999999999';
ID starts of with a character of 20 length. Then I do the following:
length newid $9.;
newssn = input(newid, ssfmt.);
09-09-2014 01:24 PM
As you noticed, SAS complains when you try to apply a numeric format (such as ssn. or z9.) to a character variable. Since your variable is defined as 20 characters long, you can replace it with the proper value using the tools that data_null_ suggested:
idnumber = put(input(left(idnumber),9.), ssn.);
If you want to keep IDNUMBER as is, you could always assign this value to a new variable instead.