BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djrisks
Barite | Level 11

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

5 REPLIES 5
DR_Majeti
Quartz | Level 8

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

ballardw
Super User

@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.

djrisks
Barite | Level 11

Hi Majeti,

 

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

Cynthia_sas
SAS Super FREQ

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.

 

 

djrisks
Barite | Level 11

Thanks for confirming Cynthia, and for this information.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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