- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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