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.

 

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 3020 views
  • 0 likes
  • 2 in conversation