Hello,
I would like to add Page X of Y to my PDF output. I noticed that the ""^{lastpage}"" command in "Page ^{thispage} of ^{lastpage}" does not output my graph as expected. When I use the code below, only the first page has a graph, but the rest of the pages are blank. This is seen in the attached output - editable_pdf.pdf. There are 6 fuel types, so there should be 6 pages of graphs.
proc sort data = sashelp.gas out = gas;
by fuel;
run;
options printerpath=pdf;
options nonumber nodate;
goptions reset = all;
ods escapechar="^";
title "Page ^{thispage} of ^{lastpage}";
ods graphics / reset = all;
ods pdf file = "C:\vector\output\editable_pdf.pdf" nogtitle;
proc sgplot data = gas;
by fuel;
styleattrs datalinepatterns=(solid);
loess y=nox x=eqratio;
run;
ods pdf close;
When I calculate the pages numbers with a macro (as shown below) and use that number instead of ""^{lastpage}"" , then the graphs output as expected.
proc sort data = sashelp.gas out = gas;
by fuel;
run;
* Working out total number of pages with macro;
proc sql;
select strip(put(count(distinct fuel), best.)) into: totpage
from gas;
quit;
options printerpath=pdf;
options nonumber nodate;
goptions reset = all;
ods escapechar="^";
title "Page ^{thispage} of &totpage";
ods graphics / reset = all;
ods pdf file = "C:\vector\output\editable_pdf2.pdf" nogtitle;
proc sgplot data = gas;
by fuel;
styleattrs datalinepatterns=(solid);
loess y=nox x=eqratio;
run;
ods pdf close;
Does anyone know why using Page ^{thispage} of ^{lastpage} does not produce the graph properly?
Many thanks,
Kriss
... View more