Using @ as the ESCAPECHAR with LASTPAGE will not work in PDF output


In the PDF destination, customized page numbers can be written in TITLE or FOOTNOTE statements with the THISPAGE and LASTPAGE functions. However, if an escape character of @ is defined and LASTPAGE is used, the text appears as

   1 of @

The following code replicates this behavior:

   ods listing close;
   ods pdf file='test.pdf';
   ods escapechar='@';

   proc print data=sashelp.class;
   title 'Page @{thispage} of @{lastpage}';
   run;

   ods pdf close;
   ods listing close;   

This occurs only in the PDF destination. An @ is being used in the code that is run behind the scenes with the LASTPAGE function, and this causes the conflict. The workaround is to choose another character as the ESCAPECHAR.