<?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: Adding Table to Existing Text in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7146#M2707</link>
    <description>Thanks for your useful code</description>
    <pubDate>Thu, 20 Mar 2008 13:48:45 GMT</pubDate>
    <dc:creator>Kwok</dc:creator>
    <dc:date>2008-03-20T13:48:45Z</dc:date>
    <item>
      <title>Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7139#M2700</link>
      <description>Hi Everyone!  &lt;BR /&gt;
   I was wondering if there was a way to add a table or graph to an existing text document.  For example, if we have a Word document containing specific text, I would like to add table output from PROC REPORT or a graph to the text, and write the result out to a single RTF document.&lt;BR /&gt;
&lt;BR /&gt;
   If this is possible, are there ways to control where the insertion of the table or graph occurs?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!!&lt;BR /&gt;
&lt;BR /&gt;
-Phil</description>
      <pubDate>Tue, 26 Feb 2008 20:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7139#M2700</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-02-26T20:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7140#M2701</link>
      <description>Hi:&lt;BR /&gt;
  It is much easier to append a new HTML file to an existing HTML file, than it is to append a new RTF or PDF file to an existing RTF or PDF file.&lt;BR /&gt;
 &lt;BR /&gt;
  See these Tech Support notes:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/24/034.html" target="_blank"&gt;http://support.sas.com/kb/24/034.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/23/660.html" target="_blank"&gt;http://support.sas.com/kb/23/660.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  The info about the RTF file also applies to PDF. Basically, both RTF and PDF have a very stringent (not flexible) syntax for the way they want the file open and file close to be specified. &lt;BR /&gt;
&lt;BR /&gt;
  You might consider writing a little VB script for Word that opens the first RTF file, brings in or inserts the second RTF file and then resaves the "new" document over the first file name. There might be 3rd party software that allows you append 2 RTF files together -- I'm betting they strip out the file close from the first file and the file open from the second file to make it work. I suppose you could also write a DATA step program to post process the 2 files and do the same thing, but the few times that I've messed with post-processing RTF, I've generated a corrupted RTF file too easily. RTF is hard to figure out and 1 wrong curly brace or \ and bam, you've corrupted the RTF file and Word won't open it.&lt;BR /&gt;
&lt;BR /&gt;
Of course, one simple technique might be to save your original output objects (if possible) in an ODS Document store and then when you need to add information, you could replay the first document's output objects with the new output objects and make a new RTF file or write over the old name.&lt;BR /&gt;
&lt;BR /&gt;
Another thing you could do is use ODS RTF TEXT= to insert big blocks of text around your table and/or graph. This is sort of doing the reverse that you asked about -- you would be taking the text from the first document and would add it to the new document.&lt;BR /&gt;
 &lt;BR /&gt;
An example of using ODS RTF TEXT= is shown below.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  length bigtext $2000 line $100;&lt;BR /&gt;
  retain bigtext;&lt;BR /&gt;
      &lt;BR /&gt;
  infile datalines dsd dlm=',';&lt;BR /&gt;
  input lineno line $ ;&lt;BR /&gt;
  bigtext = catx(' ',bigtext,line);&lt;BR /&gt;
      &lt;BR /&gt;
  ** can not use end= with datalines, so use lineno var;&lt;BR /&gt;
  ** to create macro variable at end of poem.;&lt;BR /&gt;
  if lineno = 8 then do;&lt;BR /&gt;
    call symput('jabber',trim(bigtext));&lt;BR /&gt;
  end;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1,"Twas brillig and the slithy toves,"&lt;BR /&gt;
2,"Did gyre and gimble in the wabe."&lt;BR /&gt;
3,"All mimsy were the borogroves."&lt;BR /&gt;
4,"And the mome raths outgrabe."&lt;BR /&gt;
5,"Beware the Jabberwock, my son!"&lt;BR /&gt;
6,"The jaws that bite, the claws that snatch."&lt;BR /&gt;
7,"Beware the Jubjub bird and shun"&lt;BR /&gt;
8,"The frumious Bandersnatch!"&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
%put ---------&amp;gt; &amp;amp;jabber;&lt;BR /&gt;
   &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
  &lt;BR /&gt;
options orientation=portrait center;&lt;BR /&gt;
ods rtf file='c:\temp\addtext.rtf' startpage=no nokeepn;&lt;BR /&gt;
ods escapechar='^';&lt;BR /&gt;
      &lt;BR /&gt;
title 'What This Report Needs Is Some Jabberwocky';&lt;BR /&gt;
      &lt;BR /&gt;
ods rtf text="^S={font_style=italic font_weight=bold just=l}&amp;amp;jabber &amp;amp;jabber &amp;amp;jabber";&lt;BR /&gt;
    &lt;BR /&gt;
proc print data=sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
ods rtf text="^S={foreground=red font_face=Arial font_size=10pt just=l}&amp;amp;jabber &amp;amp;jabber";&lt;BR /&gt;
    &lt;BR /&gt;
proc print data=sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
ods rtf text="^S={foreground=green font_face=Arial font_size=10pt just=l}&amp;amp;jabber &amp;amp;jabber";&lt;BR /&gt;
  &lt;BR /&gt;
ods rtf close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 26 Feb 2008 23:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7140#M2701</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-02-26T23:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7141#M2702</link>
      <description>Cynthia, &lt;BR /&gt;
&lt;BR /&gt;
ok for this ods rtf text=  manner of doing even if my knowledge of english did not permit me&lt;BR /&gt;
to understand every nuances of a jabberw...!&lt;BR /&gt;
&lt;BR /&gt;
but why in the three proc print  does i have  'subliminal' non printable text before Obs&lt;BR /&gt;
[pre]&lt;BR /&gt;
.(. tc "Print" \f  \l 1...."Dataset SASHELP CLASS " \f C \1 2)&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
      <pubDate>Wed, 27 Feb 2008 09:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7141#M2702</guid>
      <dc:creator>Andre</dc:creator>
      <dc:date>2008-02-27T09:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7142#M2703</link>
      <description>Cynthia,&lt;BR /&gt;
   Thank you so much for the information!  As always, you seem to have the answer!!  I will test out the different options that you provided, and I will let you know if any of them work for what I need.  I have a feeling that the TEXT= method might be sufficient for what I am trying to do.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again!!&lt;BR /&gt;
&lt;BR /&gt;
-Phil</description>
      <pubDate>Wed, 27 Feb 2008 14:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7142#M2703</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-02-27T14:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7143#M2704</link>
      <description>Andre:&lt;BR /&gt;
  ODS RTF inserts RTF control strings into various places in the document in order to build a TABLE OF CONTENTS (IF you turn on the CONTENTS=YES option).&lt;BR /&gt;
 &lt;BR /&gt;
  This behavior is described here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/10/379.html" target="_blank"&gt;http://support.sas.com/kb/10/379.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  You can disappear the characters with the SHOW/HIDE button inside Word. Or, you can tell ODS RTF not to insert them at all. The ODS option is described in the Tech Support note and to use it, you would have this in your code:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  ods rtf file='somefile.rtf' notoc_data;&lt;BR /&gt;
   ... more code...&lt;BR /&gt;
  ods rtf close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 27 Feb 2008 15:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7143#M2704</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-02-27T15:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7144#M2705</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Your example is good but the 2nd table was split  between 2 pages. What would your code look like if I want the table not to split ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 19 Mar 2008 13:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7144#M2705</guid>
      <dc:creator>Kwok</dc:creator>
      <dc:date>2008-03-19T13:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7145#M2706</link>
      <description>Hi:&lt;BR /&gt;
  The NOKEEPN option tells RTF that it's OK for the Word Processor (MS-Word) to split the table between pages. The KEEPN option tells RTF that you want an entire table to stay together, if possible.&lt;BR /&gt;
 &lt;BR /&gt;
  So the changed code for the invocation would look like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods rtf file='c:\temp\addtext.rtf' keepn startpage=no ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 19 Mar 2008 21:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7145#M2706</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-19T21:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Table to Existing Text</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7146#M2707</link>
      <description>Thanks for your useful code</description>
      <pubDate>Thu, 20 Mar 2008 13:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-Table-to-Existing-Text/m-p/7146#M2707</guid>
      <dc:creator>Kwok</dc:creator>
      <dc:date>2008-03-20T13:48:45Z</dc:date>
    </item>
  </channel>
</rss>

