05-02-2013 11:17 AM
16246 + length ln_no $10;
16248 + set loans;
16249 + if Account__ = . then ln_no = ' ';
16250 + else ln_no = put(Account__,z10.);
ERROR 48-59: The format $Z was not found or could not be loaded.
This error occurs using the account number. This is an attempt to treat the Account_ as a character. Not sure why I am getting the error
05-02-2013 03:33 PM
I ended up using the following:
length ln_no $10;
if Account__ = . then ln_no = ' ';
else ln_no = put(input(Account__,??10.),z10.);
The program ran ok and I get output. In a few cases I get an error message due to very large account numbers. See example. Was I also supposed to use
ln_no = compress(ln_no,'.');
If so, would that account for account numbers that are extremely large. How would I plug that part of the code into the one I show here? The report runs on a unix server. Since I get output and the program does not stop, I may still be ok but wanted to get rid of the error
NOTE: Invalid numeric data, ACCOUNT__='21,500,002,156,297,200' , at line 95 column 6.
05-02-2013 04:41 PM
The error message is from this line expression:
Account__ = .
Suppression of that error message is why I reversed your logic. My example will generate the variable LN_NO for all values of account. The ?? in front of the INFORMAT will suppress the error message. The other advantage of doing the PUT() function first is that if LN_NO is not defined in the input dataset then SAS will know to create it as a character variable of length 10 based on the use of Z10. format.
If the value in ACCOUNT__ is invalid then the INPUT() function will return missing and the PUT() function should spit it out as a period in position 10. (depending of the setting of the option MISSING). So the COMPRESS() function will convert the period to a space.
You might need more complex logic if the variable ACCOUNT__ is longer than $10. Using INPUT(ACCOUNT__,10.) will only read the first 10 characters. So if ACCOUNT__ is twelve digits long it will ignore the last two, so '000000000100' would be converted to 1 instead of 100.