BookmarkSubscribeRSS Feed
Sasuser52
Fluorite | Level 6

We use the contents=yes option in ods pdf to get a printed table of contents in a pdf document, but we don't like that the toc is positioned at the beginning of the pdf file. Is there another technique to get a pdf document starting with a cover sheet, followed by a toc with correct page numbers and then the actual contents.

ods pdf file="..." contents=yes  pdftoc = 1 startpage=no;
4 REPLIES 4
Sasuser52
Fluorite | Level 6

Thank you for your kind answer. I know the documentation for "ods pdf", but I see no possibility to place the TOC behind a cover sheet. That's why I asked for another technique ...

smantha
Lapis Lazuli | Level 10

The closes I came to your requirement

ods html close;   /* Not needed if using SAS Studio */
proc template;
   define style Styles.CustomTitle;
   parent=Styles.pearl;
      class ContentTitle from ContentTitle /
              pretext='My Customized Title';
   end;
run;


ods pdf file="C:\Users\mantsu01\Documents\CustomTOC.pdf";
options nodate nonumber;
ods proclabel "This is the cover page";

data new;
header='Created by SM on 06-10-2020';
label header = 'Title of my project';
run;

proc print noobs labels;
*where not missing(header);
run;

options number;

options pageno=1;
ods proclabel "Crosstab of SASHELP.CARS";
proc freq data=sashelp.cars;
   tables origin*type / contents="";
run;

ods proclabel "All variables: SASHELP.CARS";
proc print data=sashelp.cars contents="Second level";
run;


ods pdf close;   /* Not needed if using SAS Studio */
ods html;

proc template;
delete Styles.CustomTitle;
run;
Sasuser52
Fluorite | Level 6

Thank you, Smantha, for the time you have invested. I recognize that you were able to adjust the page numbering and I have learned something. But, maybe I was not clear, that my main problem ist the TOC appearing at the start of the document which in my context is very ununusal.  I have given up and accepted that that SAS currently does not provide an easy way to locate the TOC in an pdf document properly.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1006 views
  • 0 likes
  • 2 in conversation