BookmarkSubscribeRSS Feed
skygold16
Fluorite | Level 6

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.

7 REPLIES 7
Cynthia_sas
SAS Super FREQ

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

skygold16
Fluorite | Level 6

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.

skygold16
Fluorite | Level 6

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

Quentin
Super User

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.


BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
skygold16
Fluorite | Level 6

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.

mattyclown
Fluorite | Level 6

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

Bari_sas
SAS Employee

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 !

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 5771 views
  • 1 like
  • 5 in conversation