BookmarkSubscribeRSS Feed
ninafelices
Calcite | Level 5

Hello, 

 

I am hoping to make a PDF with page numbers within the top right hand corner of the PDF. Following others recommendations on a separate question, I tried to use ods escapechar='^'; combined with options pageno = 1;. However, this is still not working. I also understood that there is some issues using ODS PDF and obtaining page numbers. 

 

I have attached the code I was using below:

 

ODS PDF FILE ="...pdf";
OPTIONS NODATE NONUMBER;
ods escapechar='^';


options pageno = 1;
TITLE "...";
FOOTNOTE "....";
PROC REPORT DATA=....;
COLUMNS Statistic ('Statistical Results' (DF Value Prob));
DEFINE Statistic / '';
RUN;
;
options pageno = 2;
TITLE1 "....;
PROC SGPLOT DATA = ...... NOAUTOLEGEND;
REFLINE 1.8/ AXIS = Y
LABEL = "......."
LABELLOC=INSIDE
LINEATTRS= (COLOR = INDIGO
PATTERN= SHORTDASH);
VBAR datacd/ RESPONSE = COLPERCENT
DATALABEL STAT= SUM
GROUP= .......
FILLATTRS=(COLOR=LIGHTSALMON);
FORMAT ColPercent;

XAXIS OFFSETMIN= 0.25
LABEL = "____"
LABELATTRS = (WEIGHT= BOLD);

YAXIS VALUES =(0 TO 4 BY 1)
OFFSETMIN= 0
GRID
LABEL ="Percent"
LABELATTRS = (WEIGHT = BOLD)
VALUEATTRS = (WEIGHT = BOLD);

RUN;
FOOTNOTE ",,,,,";
TITLE;
FOOTNOTE;

 

options pageno = 3;
TITLE "___";
FOOTNOTE "_____";

PROC PRINT
DATA = Study
OBS = 'Variables' SPLIT = '*';
LABEL Dependent = 'Variable*Name'
FValue = 'F*Statistic'
ProbF = 'P-Value';
RUN;
ODS PDF CLOSE;

 

3 REPLIES 3
ballardw
Super User

As a minimum I would expect to see something attempting to use the {Thispage} function with the specified Escapechar with either Title, Footnote or maybe an ODS TEXT statement.

 

Here is an example from the documentation placing the page info into a footnote:

ods pdf file="your-file-path/yourfilename.pdf" startpage=no nogtitle;
ods escapechar="^"; title "^{style [fontstyle=italic] Predicted ^{style [fontstyle=roman]and } ^{style [foreground=italic]Actual } ^{style [fontstyle=roman]Sales}}"; title2 "^{style [color=orange ]For Furniture By Region}";

/* here is the page info at the bottom of a page*/ footnote "Page ^{thispage} of ^{lastpage}"; proc print data=sashelp.prdsale (obs=10);
var product region actual predict;
run;

ods pdf close;

 

NikitaTovey
Fluorite | Level 6
Remove:
OPTIONS NODATE NONUMBER;
ods escapechar='^';

And replace with:
OPTIONS NODATE;

Also remove the following statements from each section:
options pageno = ;

Page numbers should automatically appear in the top right corner of the report.
GallagherML
Calcite | Level 5
Hey there!

As someone mentioned, I would remove the 'NO NUMBER' from your first OPTIONs statement.
I think, then, just having 'OPTIONS PAGENO=1;' between your ods endchar; and TITLE statements. Then, you can remove the other 'OPTIONS PAGENO=.'

I saw that someone mentioned they should be automatic, but I know this should work!
Thanks and best of luck

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1134 views
  • 0 likes
  • 4 in conversation