BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Daniel
Obsidian | Level 7

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
1 ACCEPTED SOLUTION

Accepted Solutions
Daniel
Obsidian | Level 7

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

4 REPLIES 4
Cynthia_sas
SAS Super FREQ


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

Daniel
Obsidian | Level 7

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.

ballardw
Super User

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

Daniel
Obsidian | Level 7

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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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