Hi, I´m using ODS RTF to print a Report, but I can´t figure out the best way to write a text without having to deal with the tables that comes with any TEXT commands.
The only one I found that do not come within a table is "\pard" and "\par", but instead, comes with a table line AFTER the text.
Here is the code:
ods RTF file="test.rtf" ;
proc odstext;
p "REPORT 1";
run;
ods RTF text="{\line}";
ods RTF text ="REPORT 2";
ods RTF text="{\line}";
ods RTF text="{\pard REPORT 3 \par}";
ods RTF close;
Here is the Output:
OBS: Turn on "SHOW GRIDLINES" in Microsof Word to see the table properly.
Does anyone know a way to write texts without tables around with ODS RTF?
You can try ODS TAGSETS.RTF and see if that meets your needs.
ods tagsets.rtf file="test.rtf" options(Tables_off='Usertext') ; proc odstext; p "REPORT 1"; run; ods tagsets.rtf text="{\line}"; ods tagsets.rtf text ="REPORT 2"; ods tagsets.rtf text="{\line}"; ods tagsets.rtf text="{\pard REPORT 3 \par}"; ods tagsets.rtf close;
You can set other style elements off as well but most of those really do need the tables for proper formatting.
Length of code is generally irrelevant. The specific options might be worked around but would need examples.
/*
You could try TITLE
OR Try style PRETEXT=
*/
ods RTF file="c:\temp\test.rtf" startpage=no bodytitle;
proc odstext;
p "REPORT 1";
run;
ods RTF text="{\line}";
ods RTF text ="REPORT 2";
ods RTF text="{\line}";
ods text="{\pard REPORT 3 \par}";
title j=l 'REPORT 1';
title2 j=l 'REPORT 2';
proc report data=sashelp.class(obs=1) noheader nowd
style={pretext='REPORT1' frame=void rules=none just=l}
style(column)={color=white cellwidth=1 cellheight=1};
column name;
run;
title3 j=l 'REPORT 3';
proc sql ;
select name from sashelp.class(obs=0);
quit;
title;
ods RTF close;
/*
Alternative way is using pre-product ODS WORD.
*/
ods word file="c:\temp\test.docx";
proc odstext;
h2 "REPORT 1"/style={color=black};
h2 "REPORT 2"/style={color=black};
h2 "REPORT 3"/style={color=black};
run;
ods word close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.