%let vc = 12025;
ideal output (with format comma ) is 12,025;
but %put %sysfunc(put(&vc,comma6.)) seems not working. Error as below.
ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found.
The PUT function is not available with %SYSFUNC, however you can use PUTN for numeric values, or PUTC for character.
Try :
%put %sysfunc(putn(&vc,comma6.));
An alternative to using the putn() function to format values returned by %sysfunc() is to use the little known 2nd parameter of %sysfunc() like so:
%let vc = 12025;
%put %sysfunc(sum(&vc),comma6.);
The second argument applies a format to the result returned by whatever function %sysfunc() is calling. In the above example, I'm just summing a number by itself which effectively just returns the number. If it was a character value, I could use the cats() function.
Worth noting as it will simplify code if you want to do something like:
%put %sysfunc(putn(%sysfunc(date()),date9.));
as it becomes:
%put %sysfunc(date(),date9.);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With