proc fcmp - file log put % bug
Having worked a lot with proc fcmp
lately, I think it’s fair to say that the procedure should be ‘handled with care’.
Here’s an example of one of these weird / wonderful bugs (LIN X64, 9.04.01M3P062415):
proc fcmp outlib=work.funcs.pkg;
function test(cval $);
file log; put cval=;
put 'also.. you can % see % this';
return;
endsub;
quit;
options cmplib=work.funcs;
data null;
x="example %";
rc=test(x);
run;
When you look at the log, the percent symbols are missing:
cval=example
also.. you can see this
So this is strange, but it gets stranger. If you don’t have a clean session, you will also see parts of previous messages in the log. For instance, if you now run the exact same above code again, you get:
cval=example % see % this
also.. you can see this
So the % symbols return, in a different place! Now, whilst this is a strange bug, it only seems to affect messages sent to the log. So not an issue right?
Wrong.. It seems that this can cause a fatal error:
Conclusion? Don’t send code to production that has proc fcmp
writing character values to the log that may contain a % symbol!