I am using ODS TAGSETS.RTF text statements to place text in an RTF file. I am using tagsets as I need to use the Tables_Off="Usertext" option because I do not want the text to appear in tables. Is there a way I can make a line of text be a Heading in Word. I have started with this statement. Is there an in-line code I can use to make this a Heading in Word?
ods tagsets.rtf text="^S={outputwidth=100% just=l font_weight=bold font_face=arial fontsize=10pt} Heading text}";
I use this line to create the file
ods tagsets.rtf file="&path.\output\TEST_%sysfunc(today(), date9.).Rtf" startpage=no options(Tables_off="Usertext" doc='help' WATERMARK='DRAFT');
Thanks,
Jeff
Without a clear description of exactly where you need text not to appear as tables I would suggest simple RTF output and options in a TITLE statement for what you show:
The limitation with Titles is that some procedure output has to be involved for the title to appear. Be default all titles appear in the header and footnotes appear in the document footer.
ods rtf file="x:\example.rtf" startpage=no ; Title justify=Left Bold font=arial height=10Pt "Heading text"; proc print data=sashelp.class noobs; run; ods rtf close;
If you need to place an amount of text you might consider Proc ODSTEXT instead of ODS TEXT statements. Not quite the same options but by default the output doesn't look like it is in a "table".
Something like this example:
ods rtf file="x:\example.rtf" startpage=no ; Title justify=Left Bold font=arial height=10Pt "Heading text"; Proc odstext; p "This is a short sentence of text created by Proc Odstext."; p; p "Note that that the P is for paragraph and long amounts of text following can behave like a normal paragraph. No text on a P statement places a blank line between text as done here."; run; ods rtf close;
Proc Odstext does allow style override options but they apply differently than ODS Text. Check syntax for details as there is quite a bit more going on than with Ods Text.
Thank you for the reply. Here is what I am trying to accomplish.
Line 1: Table 1. table title {As a Word Heading but not in a table cell}
Table from PROC REPORT {this is and can be a table}
Footnotes {This I have figured out}
I had been using the following statement:
ODS RTF TEXT="^S={outputwidth=100% just=l font_weight=bold font_face=arial fontsize=10pt}{\pard\s1\li835\fi-835Table 1\tab table title1 \par}";
in conjunction with an ODS RTF file statement using wordstyle="{\s1 Heading 1 \s2 Heading 2 \s3 Heading 3;}
However, while that made the text a Heading in Word, it also put it in a Word table. Unfortunately, due to internal reporting requirements, the text for the table title must appear outside of a Word table. I am trying to avoid having to manually change the text in Word to headings.
Thanks,
Jeff
You also could get what "ods tagsets.rtf + Tables_Off="Usertext"" does by ODS RTF + PRETEXT= .
/*自定义 模板*/
ods path work.tmp(update) sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define style styles._journal;
parent=styles.journal;
style table from output / cellpadding=0 just=l;
end;
run;
ods rtf file="c:\temp\example.rtf" startpage=no style=_journal ;
proc report data=sashelp.class nowd spanrows
style={pretext="表3.1.1 受试者筛选情况(筛选人群)" fontfamily="MYingHei_18030_C-Medium" fontweight=bold fontsize=0.38cm}
;
run;
ods rtf close;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.