Dear
inside a statistical report (rtf file), I would like to add the page number in SAS tables: it's useful in tables which are split in more pages.
Thanks in advance for any help
Kind regards
Sorry, what do you mean? Page numbers are normally calculated by Word in the footnote by using:
footnote1 j=r "Page ^{thispage} of ^{lastpage}";
This is easier than calculating it your self.
If however you have to have page numbers in the data then you would need to do:
Work out how many pages there will be once rendered - this may not be the same as you think bearing in mind word wrapping/style/borders page size/line size etc. Then you add that info into your data and output per any other data. With graphs for instance it may be easy:
data _null_;
set graph parameters;
call execute('footnote1 j=r "Page '||strip(put(_n_,best.))||' of ||'strip(put(tot,best.))'||";');
...
run;
For tables and listings you could be in for whole mess of coding.
Thanks. I'm referring to the number in red in the file attacched (example_sas.doc).
Kind regards
Yes, not sure what proc output that's generated from but myself I would do:
report to rtf with:
ods escapechar='^';
footnote1 j=r "Page ^{thispage}";
Then print the rtf to pdf. You could however go directly to PDF with the same syntax. Me, I would also put a breaking section in the report to get a clean break. So:
data mydata;
set mydata;
retain pge;
if _n_=1 then pge=1;
if _n_ = 20 then pge=pge+1;
run;
proc report data=mydata;
columns pge ...;
define pge / order noprint;
...
break after / pge;
...
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.