The SAS Output Delivery System and reporting techniques

ODS RTF Tagset Free text justification

Reply
Super Contributor
Posts: 333

ODS RTF Tagset Free text justification

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

Super User
Posts: 10,540

Re: ODS RTF Tagset Free text justification

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";

SAS Super FREQ
Posts: 8,744

Re: ODS RTF Tagset Free text justification

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;

Super Contributor
Posts: 333

Re: ODS RTF Tagset Free text justification

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. 

Super Contributor
Posts: 333

Re: ODS RTF Tagset Free text justification

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

Ask a Question
Discussion stats
  • 4 replies
  • 328 views
  • 3 likes
  • 3 in conversation