Violaine:
In order to post process the RTF file you must
1) understand the RTF string that you are currently generating (this involves creating an RTF file that is the closest to the one you want and then examining the file in Notepad)
2) understand the RTF string that you want to have (research the RTF spec)
3) write a SAS program to read in the RTF file after it's been created
3a) scan the RTF file for the string of interest -- line by line
3b) change the string of interest to the new string (when you find it)
3c) write file back out to a new file
4) open the NEW RTF file and make sure you have achieved your desired results
The reason I do not generally recommend this method is that #1 and #2 are a fairly large undertaking. If you do NOT understand RTF control strings or get your code exactly right for doing the substitution, then you can very, very easily corrupt the new RTF file and make it unopenable. (a single missing { or poorly placed \ will corrupt the file).
For example, when you use the JOURNAL style in RTF, you get a single line at the top and bottom of the table and a single line underneath the column headers. It is possible to change the single line under the column headers to a double line, but you have to know that the single line control string is:
\clbrdrb\brdrs
and that the double line string would be:
\clbrdrb\brdrdb
I do not know RTF well enough to be able to tell you what the spanning/merging syntax would be. However, you can experiment with the double line post processing program in this program:
[pre]
** this is the file for #1;
ods rtf file='c:\temp\freq.rtf' style=journal;
ods noproctitle;
proc freq data=sashelp.shoes;
tables region;
run;
proc print data=sashelp.class;
run;
ods rtf close;
** freq.rtf is from #1;
** dblout.rtf is the NEW RTF file -- for #4;
filename sngl_in "c:\temp\freq.rtf";
filename dbl_out "c:\temp\dblout.rtf";
** this is the program for step #3 -- you MUST understand the RTF;
** control strings in order for this to work.;
** upon my examination of the file, I determined that the place where I needed;
** to change my string was on a line where the length was GT 23 AND I had;
** to make sure I got the line under the column headers and not the line at the;
** bottom of the table.;
data _null_;
infile sngl_in lrecl=4096 recfm=v length=ln;
file dbl_out lrecl=4096 recfm=v;
input;
where_bdr = index(_infile_,'clbrdrb');
** make sure that you have a "long" line and that the clbrdrb string;
** DOES appear in the line (where_bdr ne 0);
if ln gt 23 and where_bdr ne 0 then do;
** for the output I tested (freq and print -- the RTF string;
** for a single line under the header started at position 31;
** but the line at the bottom of the table starts in position 2, so;
** you do NOT want that to change;
if where_bdr gt 2 and substr(_infile_,31,14)='\clbrdrb\brdrs' then do;
_infile_=substr(_infile_,1,30)||'\clbrdrb\brdrdb'||substr(_infile_,45);
** have increased the length of the _infile_ line by 1 character;
** so increase the length variable by 1;
ln+1;
end;
end;
put _infile_;
run;
** Now, check the log and assuming no errors;
** open the RTF file with Word -- you will NOT see the file in;
** the SAS Results Window because it was created with a;
** DATA step program.;
[/pre]
Before I could write a successful program, I had to spend a LOT of time reviewing the FREQ.RTF file in Notepad trying to figure out WHICH "\brdrs" needed to change since I have multiple single lines in the RTF file.
Good luck with your efforts!
cynthia