title: SAS ODS PDF: Table of Contents
body: <p>Here a SAS code sample:</p>
  
  <pre><code>ODS LISTING CLOSE;
  GOPTIONS DEV=SASPRTC;
  ODS PDF FILE="test_toc.pdf" CONTENTS=YES ;
  ODS DOCUMENT NAME=REPORTTOC(WRITE);
  
  ODS PROCLABEL="1 - Title level 1" ;
  TITLE1 "1 - Title level 1" ;
  TITLE2 "1.1 - Title level 2: Horsepower" ;
  PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="1.1 - Title level 2: Horsepower"; 
      COLUMN Horsepower ;
      DEFINE Horsepower / DISPLAY PAGE CONTENTS="" ;*Note1: According to SAS documentation, contents="" should delete "Table 1" from the TOC but it does not work;
  RUN;
  TITLE2 "1.2 - Title level 2: Type" ;
  PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="1.2 - Title level 2: Type"; 
      COLUMN type ;
      DEFINE type / DISPLAY PAGE CONTENTS="" ;*Note2: idem;
  RUN;
  
  ODS PROCLABEL="2 - Title level 1" ;
  TITLE1 "2 - Title level 1" ;
  TITLE2 "2.1 - Title level 2: Horsepower" ;
  TITLE3 "2.1.1 - Title level 3: Horsepower" ;
  PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="2.1 - Title level 2: Horsepower"; 
      COLUMN Horsepower ;
      DEFINE Horsepower / DISPLAY PAGE CONTENTS="2.1.1 - Title level 3: Horsepower" ;
  RUN;
  TITLE2 "2.2 - Title level 2: Type" ;
  TITLE3 "2.2.1 - Title level 3: Type" ;
  *Note3: Can I add another level of title (TITLE4) in the TOC before the display of this PROC REPORT? ;
  PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="2.2 - Title level 2: Type"; 
      COLUMN type ;
      DEFINE type / DISPLAY PAGE CONTENTS="2.2.1 - Title level 3: Type" ;
  RUN;
  
  ODS DOCUMENT CLOSE;
  ODS PDF CLOSE;
  GOPTIONS RESET=ALL;
  ODS LISTING;
  
  PROC DOCUMENT NAME=REPORTTOC(update);
  
  MOVE Report#2\Report#1 TO report#1 ;
  
  MOVE Report#4\Report#1 TO report#3;
  RUN;
  
  ODS PDF FILE='test_toc.pdf' CONTENTS=YES ;
  REPLAY; RUN;
  ODS PDF CLOSE;
  QUIT;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/nLnFF.png" rel="nofollow">This code produces this TOC</a></p>
  
  <p>My problem is that I would like to be able to add levels in the TOC without using more procedures (Cf. Note3 in the code sample).</p>
  
  <p>I would like to link directly the TITLE statement in the TOC without using ODS PROCLABEL="text" or CONTENTS="text". </p>
  
  <p>Is it possible (I'm running SAS 9.2)?</p>