BookmarkSubscribeRSS Feed
esjackso
Quartz | Level 8

I was wondering if anyone has been able to use ODS RTF Tagset to control the justification of text in a report. The in line formating code doesn't seem to alter the results. If anyone can provide an example it would be helpful.

Thanks

EJ

4 REPLIES 4
ballardw
Super User

Below are some style elements for use with ODS RTF text I placed in macro variables as I was using them in multiple places and an example of how to apply to a string of text using the ODS ESCAPECHAR option.

 

ods escapechar='^';

%let tstyle1 = ^S={fontsize=16PT just=C leftmargin=1.0in rightmargin=1.0in} ; /*section titles*/

%let tstyle2 = ^S={fontsize=12PT just=C leftmargin=1.0in rightmargin=1.0in} ; /* Main title */

%let tstyle3 = ^S={fontsize=10PT just=C leftmargin=1.0in rightmargin=1.0in} ; /* secondary title */

%let tstyle4 = ^S={fontsize=12PT just=L fontweight=MEDIUM leftmargin=1.0in rightmargin=1.0in} ; /*Body text */

%let tstyle5 = ^S={fontsize=12PT just=L fontweight=BOLD leftmargin=1.0in rightmargin=1.0in} ; /*Body text bold*/

%let tindent = ^S={fontsize=12PT fontweight=MEDIUM leftmargin=1.5in rightmargin=1.0in} ; /*Body text indented*/

%let tindent2= ^S={fontsize=12PT fontweight=MEDIUM leftmargin=2.in rightmargin=1.0in} ; /*Body text indented 2nd level*/

%let tstyle7 = ^S={fontsize= 8PT just=L fontweight=MEDIUM leftmargin=1.0in rightmargin=1.0in} ; /*Footnote text*/

Using one of the style to display a line of text using the line style I want.

ods rtf text= "&l2style Some text I want withat style";

Cynthia_sas
SAS Super FREQ

Hi:

In addition to using ODS RTF TEXT= or just ODS TEXT=, you can achieve justification in the columns in a report by using STYLE= overrides. If you run the code below, you should see a marked difference between the justification in #1 and the justification for each column in #2. I made the cells big enough to see the difference.

cynthia

data testit(keep=name bigtext bigtext2);
  set sashelp.class(obs=2);
  length bigtext bigtext2 $400;
  bigtext = "Twas brillig and the slithy toves "||
             "did gyre and gimble in the wabe. "||
             "All mimsy were the borogroves "||
             "and the momeraths outgrabe. "||
             "Beware the Jabberwock, my son!"||
             "The jaws that bite, the claws that snatch!"||
             "Beware the Jubjub bird and shun "||
             "the frumious Bandersnatch!";
  bigtext2 = bigtext;
  output;
run;

        
ods rtf file='c:\temp\testit.rtf' ;
proc report data=testit nowd;
  title '1) default just is left';
  column name bigtext bigtext2;
  define name / order;
  define bigtext  / 'Text just=l'
     style(column)={cellwidth=3in};
  define bigtext2 / 'text just=l'
     style(column)={cellwidth=3in};
run;
 
proc report data=testit nowd;
  title '2) changed just for each column';
  column name bigtext bigtext2;
  define name / order;
  define bigtext  / 'Text just=r'
     style(column)={cellwidth=3in just=r};
  define bigtext2 / 'text just=c'
     style(column)={cellwidth=3in just=c};
run;
ods rtf close;

esjackso
Quartz | Level 8

Thanks Cynthia,

I probably misled you by saying it is a report. Actually we are trying to add text in between procs (freqs, reports, tabulates etc) and we had to use the ODS RTF Tagset to control the spacing in between those procs. When we did that the in line formatting stopped working so we were looking for a in line formatting for ODS RTF Tagset text= option. 

esjackso
Quartz | Level 8

Thanks,

We have found that once we start using the ODS RTF Tagset to alter spacing between procs output, the standard in line formatting of ods rtf no longer works. So we were hoping that there was an answer using ODS RTF Tagset.

But I really like this idea for other things. Its similar to having styles in word and can help standardize things in long reports.

EJ

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
  • 1106 views
  • 3 likes
  • 3 in conversation