The SAS Output Delivery System and reporting techniques

PDF Page number issue

Reply
Occasional Contributor
Posts: 18

PDF Page number issue

Hello All,

I am working on creating a .pdf file from BASE SAS programming and having some strange output.

I am using ODS to create pdf file.

I am trying to put page number at the bottom of every page of .pdf file using

FOOTNOTE HEIGHT=6PT justify=right 'page ^{thispage} of ^{lastpage}';

We have process where we create a code in BASE SAS and then we run it via DI Studio.

When I run this in BASE SAS, I can see page number appearing only on first page and when I run it through DI, it shows page number only on first page but lastpage number is displayed as junk character like "g<L page 1 of g>"

Can anyone suggest me anyway out? I am running in 9.3 BASE SAS version and 4.3 DI Studio.


your help is appreciated.

SAS Super FREQ
Posts: 8,818

Re: PDF Page number issue

Hi,

  I'd recommend that you work with Tech Support on this. I assume you've checked that ODS ESCAPECHAR is set properly on the DI Studio server (since you don't show the value of the statement) in your code. I don't have a DI Studio installation on which to test, but Tech Support could look at both your logs and ask relevant questions about your DI studio code (regarding the server).

cynthia

Occasional Contributor
Posts: 18

Re: PDF Page number issue

Hi Cynthia,

Here is code snippet :

OPTIONS orientation=landscape;

OPTIONS nodate nonumber nobyline;

ODS escapechar="^";

ODS PDF file="&path.\&filename." notoc style=sasdocPrinter;

TITLE justify=left 'OUTGOING ****** REPORT';

FOOTNOTE HEIGHT=6PT justify=right 'page ^{thispage} of ^{lastpage}';

Options topmargin=".5in"

bottommargin=".25in"

leftmargin=".25in"

rightmargin=".25in";

OPTIONS linesize= 179 pagesize= 65;

ODS PDF Text="^{newline 1} ";

ODS PDF Text="ORGANISATIONSNUMMER:^{nbspace 8}&Orgnr.";

PROC REPORT data=_temp_SUS_2 nowd headline headskip split='*'

style(report)=[just=left]

style(COLUMN)=[font_size=8pt]

STYLE (HEADER) = [FOREGROUND = BLACK FONT_WEIGHT = BOLD FONT_SIZE = 8PT];

column Kontonummer Persnr Kontohavare ADRESS POSTORT BELOPP_NEW;

DEFINE Kontonummer / 'KONTONUMMER' style(COLUMN)=[CELLWIDTH=1.4in];

/*..*/

/*..*/

/*..*/

/*Few more columns to display*/

RUN;

ODS PDF close;


I have set escape character in code itself and I am calling this code through DI.

Occasional Contributor
Posts: 18

Re: PDF Page number issue

Also I see another problem with this code is:

since I am using style=sasdocPrinter; a line is appearing on page 2 which says "Continuing contents of page 2, which would not fit on a single physical page"

Seems even after page 1 limit is over, it continues over 2nd page and that is the reason why I do not see page number on second page.

I tried changing it to other format, for few of SAS built in style, it worked and i could see page number on second page, but for others it did not work. Smiley Sad

PROC Star
Posts: 1,290

Re: PDF Page number issue

Ahh, I've seent that note before and lost my footer when the first page overflowed onto a second....

From this note http://support.sas.com/kb/39/915.html , it looks like ODS PDF text= may be the culprit.  The note has suggested workaround.

HTH,

--Q.


Occasional Contributor
Posts: 18

Re: PDF Page number issue

Yes, I did read this earlier, but it didn't help.

Unfortunately I couldn't find any other solution. Tried using Plateau style, but box around ODS text is appearing and its looking weird.

Occasional Contributor
Posts: 6

Re: PDF Page number issue

Here is a source code on how to add footnote to PDF that is created using ODS. And Hope it can work with your PDF processing application. Good luck.Smiley Happy

options nodate nonumber;
data work.animals;
  input name $ weight;
  datalines;
  monkey 20
  shark 500
  lion 200
  wolf 120
  buffalo 400
  ;
run;

ods pdf file = 'C:\sasdata\animals.pdf';
ods escapechar= '!';
proc print data=work.animals;
  title 'Animals';
  footnote j = r 'Page !{thispage} of !{lastpage}';
run;
ods pdf close;
ods listing;

Copied from sas page footnote in ods pdf - Stack Overflow

SAS Employee
Posts: 6

Re: PDF Page number issue

I am sure you have found your answer by now, however someone reported this problem to Technical Support and referenced your communities post, so I'd like to share the following SASnote with others who may need the reference. When the LASTPAGE text shows incorrectly (ie with garbage characters), please try options printerpath=pdf ; as discussed in this SASnote:

 

http://support.sas.com/kb/56/041.html

 

If you continue to have difficulties, please always feel free to reach out to support@sas.com !

 

 

 

 

Ask a Question
Discussion stats
  • 7 replies
  • 1824 views
  • 0 likes
  • 5 in conversation