The SAS Output Delivery System and reporting techniques

ODS Text table width

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

ODS Text table width

Hello,

When running the following program in the past (under SAS 9.1.3), the two ODS TEXT statements would create a table in the RTF document with two rows and the width of the table would be "full page width" (minus the left and right margins defined in the style. However, when I run the program in SAS 9.3, I notice that I still get a two-row table but the width is determined by the largest text content of each cell. This means that the logo that I put in the first row gets "cut" depending on the width of the second row.

Here is sample code to reproduce the issue:

ODS ESCAPECHAR="^";

ODS RTF STYLE=JOURNAL BODYTITLE FILE="TEST.RTF";

ODS RTF STARTPAGE=NEVER;

ODS RTF TEXT="^S={preimage='C:\SAS_TPTK_logo.jpg'} ";

ODS RTF TEXT="Second line";

PROC PRINT DATA=SASHELP.CLASS;

RUN;

ODS RTF CLOSE;

I've also attached two image files showing the previous and current behaviors. Is there any way I can specify the width of the table that gets created by the ODS RTF TEXT statement?

Thank you,

Daniel


old_look.PNGnew_look.PNG

Accepted Solutions
Solution
‎07-09-2013 04:18 PM
Occasional Contributor
Posts: 17

Re: ODS Text table width

I just received a reply from TS and they suggested the following two options to fix the issue:

1) Use outputwidth=100% option in the ODS TEXT statement;

2) Modify the style being used so that the the outputwidth of the ODS TEXT element (usertext in the style definition) is 100%.

1) Would be as follows:

ODS ESCAPECHAR="^";

ODS RTF STYLE=JOURNAL BODYTITLE FILE="TEST.RTF";

ODS RTF STARTPAGE=NEVER;

ODS RTF TEXT="^S={outputwidth=100% preimage='C:\SAS_TPTK_logo.jpg'} ";

ODS RTF TEXT="Second line";

PROC PRINT DATA=SASHELP.CLASS;

RUN;

ODS RTF CLOSE;


2) Would be as follows:

ods path work.template(update) sashelp.tmplmst;

proc template;

define style styles.myjournal;

  parent=styles.journal;

  style usertext from usertext / just=c outputwidth=100%;

  end;

run;

Thank you very much to Bari from TS for the quick reply and the two solutions to this problem!

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,868

Re: ODS Text table width


Hi, I no longer have SAS 9.1.3 to test with. And, at any rate, differences between 1 version of SAS and another version of SAS is a signal of something that you should open a track with Tech Support. They can test in the older version and the current version in order to open a defect with the developers, if necessary.

cynthia

Occasional Contributor
Posts: 17

Re: ODS Text table width

Posted in reply to Cynthia_sas

Thank you Cynthia, I'll contact TS. In the meantime I've found a workaround of sorts by replacing both ODS RTF TEXT statements with a PROC REPORT based on a dataset that has two observations, each equal to the contents of each ODS RTF TEXT= line and using STYLE=[FRAME=VOID RULES=NONE] to remove the borders and STYLE=[CELLWIDTH=xxIN] in the DEFINE statement to control the width.

Super User
Posts: 11,343

Re: ODS Text table width

The leftmargin and rightmargin options with RTF TEXT might also work by forcing the length of the lines.

Solution
‎07-09-2013 04:18 PM
Occasional Contributor
Posts: 17

Re: ODS Text table width

I just received a reply from TS and they suggested the following two options to fix the issue:

1) Use outputwidth=100% option in the ODS TEXT statement;

2) Modify the style being used so that the the outputwidth of the ODS TEXT element (usertext in the style definition) is 100%.

1) Would be as follows:

ODS ESCAPECHAR="^";

ODS RTF STYLE=JOURNAL BODYTITLE FILE="TEST.RTF";

ODS RTF STARTPAGE=NEVER;

ODS RTF TEXT="^S={outputwidth=100% preimage='C:\SAS_TPTK_logo.jpg'} ";

ODS RTF TEXT="Second line";

PROC PRINT DATA=SASHELP.CLASS;

RUN;

ODS RTF CLOSE;


2) Would be as follows:

ods path work.template(update) sashelp.tmplmst;

proc template;

define style styles.myjournal;

  parent=styles.journal;

  style usertext from usertext / just=c outputwidth=100%;

  end;

run;

Thank you very much to Bari from TS for the quick reply and the two solutions to this problem!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 848 views
  • 4 likes
  • 3 in conversation