With a numeric value, you have to take care of the conversion from numeric to character. substr() is a character function.
If you always have 4 digits, you could keep it numeric:
data _null_;
LOAN_APPLCTN_BNM_CODE = 1232;
new1 = int(LOAN_APPLCTN_BNM_CODE/100);
put new1=;
run;
Log:
27 data _null_;
28 LOAN_APPLCTN_BNM_CODE = 1232;
29 new1 = int(LOAN_APPLCTN_BNM_CODE/100);
30 put new1=;
31 run;
new1=12
"Clean" programming (see Maxim 25) mandates the avoidance of implicit type conversions (and the corresponding NOTEs in the log):
data _null_;
LOAN_APPLCTN_BNM_CODE = 1232;
new1 = substr(left(put(LOAN_APPLCTN_BNM_CODE,4.)),1,2);
put new1=;
run;
Log:
27 data _null_;
28 LOAN_APPLCTN_BNM_CODE = 1232;
29 new1 = substr(left(put(LOAN_APPLCTN_BNM_CODE,4.)),1,2);
30 put new1=;
31 run;
new1=12
... View more