<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic proc report, proc document and TOC in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-proc-document-and-TOC/m-p/761994#M25247</link>
    <description>&lt;P&gt;Here I'm using proc report with a by statement and&amp;nbsp; proc document to create a table of contents in a PDF file.&lt;/P&gt;&lt;P&gt;I'm wondering why "Level 3" is not displayed by in the list statement output of proc document&lt;/P&gt;&lt;P&gt;and why renaming the Table Item with setlabel creates a new item in the TOC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Default Labels in the TOC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
    by sex;
run;

ods document name=test(write); 
	proc report data=class;
	    by sex;
	    column name age height weight;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	run;
ods document close; 
 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic.JPG" style="width: 394px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62644i8B19AB1EDD319217/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic.JPG" alt="basic.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Using labels from proclabel and contents&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 
 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic2.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62646iA1DC5182B3DA52DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic2.JPG" alt="basic2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Using proc document&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 

proc document name=test;    
    list/levels=all details;
	run;
quit;

proc document name=test;   
    setlabel \Report#1\ByGroup1#1\Report#1\Report#1 '4.1';
    setlabel \Report#1\ByGroup2#1\Report#1\Report#1 '4.2';

    setlabel \Report#1\ByGroup1#1\Report#1 '3.1';
    setlabel \Report#1\ByGroup2#1\Report#1 '3.2';

    setlabel \Report#1\ByGroup1#1 '2.1';
    setlabel \Report#1\ByGroup2#1 '2.2';

    setlabel \Report#1 '1';
    
    list/levels=all  details;

	run;
quit;

 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="list.JPG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62647iF6AD5DCF3E0256E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="list.JPG" alt="list.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering why "Level 3" is not displayed in the list statement output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic3.JPG" style="width: 401px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62648iFA470B646808CB11/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic3.JPG" alt="basic3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can see that renaming the Table item creates a new entry on the last level rather than the one available at that level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Aug 2021 08:40:27 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2021-08-17T08:40:27Z</dc:date>
    <item>
      <title>proc report, proc document and TOC</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-proc-document-and-TOC/m-p/761994#M25247</link>
      <description>&lt;P&gt;Here I'm using proc report with a by statement and&amp;nbsp; proc document to create a table of contents in a PDF file.&lt;/P&gt;&lt;P&gt;I'm wondering why "Level 3" is not displayed by in the list statement output of proc document&lt;/P&gt;&lt;P&gt;and why renaming the Table Item with setlabel creates a new item in the TOC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Default Labels in the TOC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
    by sex;
run;

ods document name=test(write); 
	proc report data=class;
	    by sex;
	    column name age height weight;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	run;
ods document close; 
 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic.JPG" style="width: 394px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62644i8B19AB1EDD319217/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic.JPG" alt="basic.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Using labels from proclabel and contents&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 
 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic2.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62646iA1DC5182B3DA52DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic2.JPG" alt="basic2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Using proc document&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 

proc document name=test;    
    list/levels=all details;
	run;
quit;

proc document name=test;   
    setlabel \Report#1\ByGroup1#1\Report#1\Report#1 '4.1';
    setlabel \Report#1\ByGroup2#1\Report#1\Report#1 '4.2';

    setlabel \Report#1\ByGroup1#1\Report#1 '3.1';
    setlabel \Report#1\ByGroup2#1\Report#1 '3.2';

    setlabel \Report#1\ByGroup1#1 '2.1';
    setlabel \Report#1\ByGroup2#1 '2.2';

    setlabel \Report#1 '1';
    
    list/levels=all  details;

	run;
quit;

 
ods pdf file ="&amp;amp;xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="list.JPG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62647iF6AD5DCF3E0256E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="list.JPG" alt="list.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering why "Level 3" is not displayed in the list statement output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="basic3.JPG" style="width: 401px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62648iFA470B646808CB11/image-size/large?v=v2&amp;amp;px=999" role="button" title="basic3.JPG" alt="basic3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can see that renaming the Table item creates a new entry on the last level rather than the one available at that level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 08:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-proc-document-and-TOC/m-p/761994#M25247</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-08-17T08:40:27Z</dc:date>
    </item>
  </channel>
</rss>

