Let's pull out a few pieces of your problem and examine what happens with one of your Id_loan values.
data example;
ID_loan='F114Q1000005';
YYQn = input(substr(ID_loan,3,4), yyq4.);
put yyqn=;
z= input(YYQn, best4.); z2= input(put(yyqn,5.),best4.);
run;
If you look at the outpu yyqn is 5 digits. Z is missing missing because the default automatic conversion of a numeric to character uses a best12. format that is left justifired, so it "inputs" 4 blanks. Your Input(yyqn,best4.) should have your LOG show something like this which is always flag that you may have a problem.
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
Second, the value of YYQn as a numeric is 5 digits in that year range, so reading it back in with a Best4. (sic) informat would truncate the value to 4 digits. IF you convert the number to a string correctly then that is demonstrated in the Z2 is show above.
You repeat the exact same Input conversion error on the variable Dt_orig_qt which would also have a conversion note.
... View more