I am attempting to resolve a formatted macro variable inside ODS PDF text but am getting the error message below:-
ERROR: More positional parameters found than defined.
If I remove the formatting from the 'total' it prints as expected, but it has to be comma formatted.
Code is below. Can anyone help?
proc sql noprint;
select count(zip) format=comma10. into :total
from sashelp.zipcode;
quit; %put &total;
ods pdf file = 'c:\test.pdf';
ods pdf text = "This is the total: %left(&total)";
ods pdf close;
You're getting that error because the %LEFT function sees something like this:
%left( 123,456)
The comma appears to %LEFT as marking the end of the first parameter and the start of the second parameter.
The simplest solution would be to get rid of %LEFT. First, remove leading blanks from &TOTAL using:
%let total = &total;
Then you can simplify the later statement:
ods pdf text = "This is the total: &total";
Good luck.
You're getting that error because the %LEFT function sees something like this:
%left( 123,456)
The comma appears to %LEFT as marking the end of the first parameter and the start of the second parameter.
The simplest solution would be to get rid of %LEFT. First, remove leading blanks from &TOTAL using:
%let total = &total;
Then you can simplify the later statement:
ods pdf text = "This is the total: &total";
Good luck.
Worked brilliantly, thanks for your help!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.