BookmarkSubscribeRSS Feed
LUISBARTHOLO
Calcite | Level 5

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:

LUISBARTHOLO_1-1682357049048.png

 

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?

 

4 REPLIES 4
ballardw
Super User

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.

LUISBARTHOLO
Calcite | Level 5
Thank you ballardw!
Unfortunatelly I have almost 1.500 lines in my program and tagsets.rtf doesn´t give me all the options I need, so, it has to be ODS RTF.
ballardw
Super User

Length of code is generally irrelevant. The specific options might be worked around but would need examples.

 

 

Ksharp
Super User
/*
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;

Ksharp_0-1682424016415.png

/*
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;

Ksharp_1-1682424049905.png

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

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.

 

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1573 views
  • 0 likes
  • 3 in conversation