sassas-odsproc-report

ODS Tagsets RTF


I am trying to make underscores (_) appear in my output while using ODS Tagsets but for some unknown reasons it's not appearing as expected. I'm using SAS 9.4. It appears with Bodytitle and Bodytitle_aux but the pagebreaking is much better with Tagsets.

Unfortunately using unicode doesn't work either. Here is a sample code:

options nonumber; 
%let path=;
ods path(prepend) work.templat(update);
proc template ;
define style newstyle ;
  parent = styles.journal ;
  class Parskip /
      font = fonts("headingFont")
      cellpadding = 0 cellspacing = 0  /* Only for Measured */
      frame= void
      Rules = NONE
      BorderWidth = 0
      Color = _undef_
      BackGroundColor = _undef_;
  style byline                          / font_face="Courier New"  font_style=Roman background = white;
  style Body from Document              / font_face="Courier New" font_style=Roman background = white;
 style data                            / font_face="Courier New" font_style=Roman  ;
  style table                           / font_face="Courier New" font_style=Roman 
                                      bordercolor=black background = white borderwidth=1 ;
 style cellcontents                    / font_face="Courier New" font_style=Roman  ;
  style TitleAndNoteContainer           / font_face="Courier New" font_style=Roman  background = white;
  style ProcTitle                       / font_face="Courier New" font_style=Roman  ;
  style systemtitle                      / font_face="Courier New" font_style=Roman  ;
  style rowheader from headersandfooters / font_face="Courier New" font_style=Roman  ;
  style BodyDate                         / font_face="Courier New" font_style=Roman  ;
  style PageNo                           / font_face="Courier New" font_style=Roman ;
  style SysTitleAndFooterContainer       / font_face="Courier New" font_style=Roman ;
  style header from headersandfooters    / font_face="Courier New" font_style=Roman  background = white;
  style SystemFooter                     / font_face="Courier New" font_style=Roman bordercolor=black background = white borderwidth=1 ;
  style NoteContent                      / font_face="Courier New" font_style=Roman font_size=8pt;
end;
run ;


options papersize=letter leftmargin=3.65cm rightmargin=2.11cm topmargin=3.36cm bottommargin=3.3cm orientation=landscape;
ods escapechar="^"; 
ods tagsets.rtf file="&path.\shoes2file.rtf" options(vspace='no') options(continue_tag="no"); 
 ods tagsets.rtf style=newstyle ;
 title1 'Title: Shoes';
proc report data=sashelp.shoes(obs=10) nowd style(header)=[rules=group frame=above background=white font_size=8pt] 
        style(report)=[outputwidth=100% rules=group frame=hsides background=white font_size=8pt ]  
        style(column)=[rules=group font_size=8pt] spanrows; 
  column region product; 
  define region / '___Region___' display style(column)=[width=1.5cm asis=on just=l] style(hdr)=[asis=on just=l]; 
  define product / '___Product___' display style(column)=[width=1.5cm asis=on just=l] style(hdr)=[asis=on just=l]; 
 footnote 'Footnote Page L____4';   
run; 

ods tagsets.rtf close;
   options nonumber
           nocenter nobyline nodate formdlim='' 
           formchar="|_---|+|---+=|-/\<>*" MISSING=" " ;

In the attached photo, the highlighted circles are the places where underscores are supposed to be. Any help is appreciated.enter image description here


Solution

  • The problem is that in Courier font (really Courier New) the underscore is below even the tail of the normal characters (which makes it really useful for underlining by "overstriking").

    I am not sure how to fix the style to do it but I was able to get it to show the underscores by changing the spacing after the "paragraphs" from 0 point to 1 points. Here is data step that replaces all \sa0 commands in your RTF file with \sa20. The resulting file shows the underscores.

    data _null_;
      infile "&path/shoes2file.rtf";
      file "&path/shoes2file_fixed.rtf";
      input;
      _infile_ = tranwrd(_infile_,'\sa0','\sa20');
      put _infile_;
    run;