<?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 Re: Table of contents wrongly inserted into the table header (toc_data option) in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276814#M16055</link>
    <description>Oh, forgot your #2 question, I do not believe there is a way to cause RTF to "autofit" the columns to the width of the cell contents.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
    <pubDate>Mon, 13 Jun 2016 00:14:56 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2016-06-13T00:14:56Z</dc:date>
    <item>
      <title>Table of contents wrongly inserted into the table header (toc_data option)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276781#M16053</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to a RTF file with the table of contents, listing table titles, at page 1 and tables at the following pages. The table of contents inserts wrongly interted into the table body when the toc_data was specified, as can be seen in the following screenshot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3590i35C6C93ADD6FC8C4/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SAS_ODS_RTF_TOC_data.png" title="SAS_ODS_RTF_TOC_data.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The wrongly displayed table of contents disappeared when the NOTOC_DATA&amp;nbsp;option was specified instead of the TOC_DATA, as shown in this screenshot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3591i998BB588C7F03FAE/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SAS_ODS_RTF_NOTOC_data.png" title="SAS_ODS_RTF_NOTOC_data.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;My questions:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face="arial black,avant garde"&gt;how do I correctly insert table titles in the table of content page?&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="arial black, avant garde"&gt;&lt;SPAN style="line-height: normal;"&gt;Is there an easy way to make the table autofit to content instead of manually specifying cell width of each column? Now I have specified cWide=25 pt (cellwidth) in the macro. An example of autofit to content:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT face="arial black, avant garde"&gt;&lt;SPAN style="line-height: normal;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3592i9614E0CECEE80E5D/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SAS_ODS_RTF_NOTOC_data_autofit.png" title="SAS_ODS_RTF_NOTOC_data_autofit.png" /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial black, avant garde"&gt;&lt;SPAN style="line-height: normal;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My script files and data are attached:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;NU_020_make_reports_master.sas&lt;/STRONG&gt; is a master program where all the table files are excuted. To keep this example simple, I have just included one table.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;NU_021_table01.sas&lt;/STRONG&gt; is the file where a table is created. This file reads data into SAS&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;def_display[1].sas&lt;/STRONG&gt; contains a macro that writes the DEFINE statement in the REPORT procedure. This macro is called in the file&amp;nbsp;&lt;SPAN&gt;NU_021_table01.sas&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;STRONG&gt;NU_021_table01.txt&lt;/STRONG&gt; is the data (Tab-delimited txt) to be imported in SAS.&amp;nbsp;&lt;STRONG&gt;NU_021_table01.sas reads this data.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Logo_of_the_QIMR_small.png&lt;/STRONG&gt; is the logo that is displayed on the top left of every page in the report RTF.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;Chang &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12649i9A020C0AFBA751CD/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Logo_of_the_QIMR_small.png" title="Logo_of_the_QIMR_small.png" /&gt;</description>
      <pubDate>Sun, 12 Jun 2016 16:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276781#M16053</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2016-06-12T16:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Table of contents wrongly inserted into the table header (toc_data option)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276813#M16054</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; When I use this code in SAS 9.4, Windows,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods rtf file='c:\temp\maketoc.rtf' toc_data contents=yes;
proc print data=sashelp.class;
  title 'SASHELP.CLASS';
run;
  
proc freq data=sashelp.class;
  tables age sex;
run;
  
proc print data=sashelp.classfit;
  title 'SASHELP.CLASSFIT';
run;
  
proc freq data=sashelp.classfit;
  tables age sex;
run;
  
ods rtf close;
title;&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;And here are results. First, if I click on the "Show/Hide" symbol on the ribbon, I can see the section break at the end of the first page. SAS only puts the field codes into the RTF file, you must manually cause Word (or your word processor of choice) to build the TOC from the field codes. After I click Show/Hide, this is what I see:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="rtf_make_toc.jpg" alt="rtf_make_toc.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/3594i734F0D69F022A59A/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Initially, when you look at the file after the Update Fields code, you will probably see the TOC and the field codes because the Show/Hide button is still active. But if you turn off the button, then the field codes are hidden again.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="toc_on_sep_page.png" alt="toc_on_sep_page.png" src="https://communities.sas.com/t5/image/serverpage/image-id/3595i590A8FF2831FB0BD/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you look closely at the first cell in the table, you can see that the whole field code is something like:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="full_field_code.png" alt="full_field_code.png" src="https://communities.sas.com/t5/image/serverpage/image-id/3596i6ACAEE0B55D055F9/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you run my code and you DO get the same results that I show here, then there is something in your code that is causing the issue and you might want to open a track with Tech Support so they can look at your code and using your version of SAS and your operating system, see whether they can replicate the problem. If you run my code and you do NOT get the same results that I show here, then, that is also something that needs to be worked on with Tech Support. The Table of Contents in RTF has worked this way since SAS 9.2, so if my code does NOT work for you the same way that I illustrate in my screen shots, then something odd is happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 00:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276813#M16054</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-06-13T00:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Table of contents wrongly inserted into the table header (toc_data option)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276814#M16055</link>
      <description>Oh, forgot your #2 question, I do not believe there is a way to cause RTF to "autofit" the columns to the width of the cell contents.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Mon, 13 Jun 2016 00:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276814#M16055</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-06-13T00:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Table of contents wrongly inserted into the table header (toc_data option)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276873#M16062</link>
      <description>&lt;P&gt;I thikn you misunderstand what RTF is. &amp;nbsp;RTF is a text markup language - quite an old one and not being developed any more. &amp;nbsp;What you get out from your procedures is a text file which contains a whole set of control codes, and your text. &amp;nbsp;This file is then opened in a renderer - from your example I assume your using Word. &amp;nbsp;This renderer parses the text file and attempts to create an output representation based on the codes in the RTF. &amp;nbsp;Generally speaking this works reasonably well, however if your doing things like contents pages and such like your going to have difficulties all round - Word's TOC function didn't even exist when RTF was made. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I ask wh you are building this in RTF? &amp;nbsp;Almost all Study outputs I have seen are created in this way:&lt;/P&gt;
&lt;P&gt;- Create an RTF output from SAS for each individual output&lt;/P&gt;
&lt;P&gt;- Build a PDF for a compete section be that Tables, Listings, or Figures&lt;/P&gt;
&lt;P&gt;- Document builder teams then incorperate those into the main CSR's or other documents&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 08:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/276873#M16062</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-13T08:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Table of contents wrongly inserted into the table header (toc_data option)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/278637#M16150</link>
      <description>&lt;P&gt;hi RW9,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using a script file from someone else. Whatever can export TOC and tables to a WORD document would be good. For this purpose, which ODS do you recommend?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 11:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Table-of-contents-wrongly-inserted-into-the-table-header-toc/m-p/278637#M16150</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2016-06-20T11:21:27Z</dc:date>
    </item>
  </channel>
</rss>

