Data visualization with SAS programming

PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

Accepted Solution Solved
Reply
Super Contributor
Posts: 261
Accepted Solution

PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

[ Edited ]

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

 


Accepted Solutions
Solution
‎04-10-2018 01:02 PM
SAS Super FREQ
Posts: 9,260

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

[ Edited ]

Hi:
Look at this Tech Support note: http://support.sas.com/kb/34/573.html. It has the workaround of using &totpage, as you show. This was an interaction between graphs and {lastpage} that was reported in SAS 9.2 and doesn't look like it is fixed yet.

Cynthia

 

Update (5/9/2018): there was a defect reported on this issue. It appears that the issue is fixed in 9.4 M5 release. So if you are experiencing this problem, then upgrading to 9.4M5 should fix the issue.

 

 

View solution in original post


All Replies
Contributor
Posts: 72

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

Hi Kriss, 

 

"nogtitle" with combination title "page  ^{thispage} of ^{lastpage}" has some reltation. 

 

If you remove the "nogtitle" option in ODS PDF then graph is coming properly but "1 of 6" is not resolving. 

 

I will check it, Please check on NOGTITLE

 

Thanks,

Majeti

Super User
Posts: 13,084

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

Posted in reply to DR_Majeti

@DR_Majeti wrote:

Hi Kriss, 

 

"nogtitle" with combination title "page  ^{thispage} of ^{lastpage}" has some reltation. 

 

If you remove the "nogtitle" option in ODS PDF then graph is coming properly but "1 of 6" is not resolving. 

 

I will check it, Please check on NOGTITLE

 

Thanks,

Majeti


@DR_Majeti The "1 of 6" not resolving is likely as SAS version issue as it resolves on my 9.4.4 okay when using GTITLE.

Super Contributor
Posts: 261

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

Posted in reply to DR_Majeti

Hi Majeti,

 

Thank you. I removed nogtitle, but it's still not working. I am using SAS 9.4.

Solution
‎04-10-2018 01:02 PM
SAS Super FREQ
Posts: 9,260

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

[ Edited ]

Hi:
Look at this Tech Support note: http://support.sas.com/kb/34/573.html. It has the workaround of using &totpage, as you show. This was an interaction between graphs and {lastpage} that was reported in SAS 9.2 and doesn't look like it is fixed yet.

Cynthia

 

Update (5/9/2018): there was a defect reported on this issue. It appears that the issue is fixed in 9.4 M5 release. So if you are experiencing this problem, then upgrading to 9.4M5 should fix the issue.

 

 

Super Contributor
Posts: 261

Re: PDF Graph is not being displayed properly when I use Page ^{thispage} of ^{lastpage}

Posted in reply to Cynthia_sas

Thanks for confirming Cynthia, and for this information.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 195 views
  • 0 likes
  • 4 in conversation