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

I have four goals to learn about ODS TAGSETS.RTF and or PROC TEMPLATE.  Could you, kindly, help me learn to do some of these goals using this mock document.

 

  1. Change all page margins to 1".  
  2. Remove date, time and page number from the top of the page. 
  3. Remove grey border from table, or set color to white. 
  4. Implement a half line space between title lines.  IOW implement 0.5 line spacing, or adding spacing before and after paragraph.  

 

 

ods tagsets.rtf 
  style= daisy
  options (
    VSPACE='OFF'
  )
  ;

option nocenter;
title;

/*Because Proc Template is hard:*/
%let normal=font_size=11pt;
%let answer=[fontweight=bold liststyletype="none"];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];

proc odstext;
  p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
  p " "/style=&Small_line;
  p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
  p " "/style=&Small_line;
  p "Objectives:"/style=&sub_title;
  p;
  p '10A.  Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
  p;
run;

%let question_10A_make=0;
  proc sql noprint ;
    select distinct Make, count(*)
      into :null, :question_10A_make
      from sashelp.CARS
        where Make='Acura' 
	   ;
  run;

proc odstext;
  list;
    item "%CMPRES(&question_10A_make)"/style=&answer ;
  end;
  p;
  p "Donec Sagittis Neque Quis Starting 12-2017" /style=&mid_title ;
  p;
  p '15B.  Lorem ipsum dolor sit amet, consectetur adipiscing elit.'/style=&normal;
  p;
run;

PROC FREQ DATA=sashelp.cars (obs=50);
  TABLES Make / NOPRINT out=make ;
proc odstable data=make PAGEBREAK=NO;
  column blank Make count;
  define Make ;
     format=$ENRLST.;
     PRINT_HEADERS=OFF;
  end;
  define count;
    style=&table_answer;
    format=3.0;
    PRINT_HEADERS=OFF;
  end;
  define column  blank;
     style={cellwidth=0.6in};
     PRINT_HEADERS=OFF;
     compute as " ";
  end;
run;

proc odstext;
  p;p;
  p "To Do:"  /style=&systemtitle;
  p;
  list;
    item 'Change all page margins to 1"';
    item "Revove date, time and page number from the top of the page.";
    item "Remove grey border from table, or set color to white.";
    item "Implment a half line space between title lines.";
  end;
run;
ods tagsets.rtf close;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PhilC
Rhodochrosite | Level 12

I found all my answers in this document.  It was very helpful.

 

"SAS with Style: Creating your own ODS Style Template for RTF Output"  Lauren Haworth, May 2004, Sugi 29.

 

Working with templates is usually never easy, but it ended out being very easy.  I couldn't believe it 

 

Correction: I have updated this so that it conforms with the standard that does not use the deprecated "replace" and instead used "class".

 

ods path reset;
    ods path(REMOVE) SASUSER.templat;
    ods path(PREPEND) Work.templat(update); 

proc template;
  define style Styles.Custom;
    parent = Styles.RTF;
    class fonts /
      'docFont' = ("Arial",11pt) /* Data in table cells */
      ;
    class Table from Output /
      frame = VOID /* outside borders: void, box, above/below, vsides/hsides, lhs/rhs */
      rules = NONE /* internal borders: none, all, cols, rows, groups */
      cellpadding = 2pt /* the space between table cell contents and the cell border */
      cellspacing = 0pt /* the space between table cells, allows background to show */
      borderwidth = 0pt /* the width of the borders and rules */
    ; 
    class Body from Document /
      bottommargin = 1in
      topmargin    = 1in
      rightmargin  = 1in
      leftmargin   = 1in
    ; 
  end;
run;

option nocenter nodate nonumber ;
title;

%let normal=font_size=11pt;
%let answer=[fontweight=bold Leftmargin=0.6in ];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];

ods tagsets.rtf 
  style= Styles.Custom /*Changed*/
  options (
    VSPACE='OFF'
  )
  ;

proc odstext;
  p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
  p " "/style=&Small_line;
  p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
  p " "/style=&Small_line;
  p "Objectives:"/style=&sub_title;
  p;
  p '10A.  Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
  p;
run;

/* ... */

View solution in original post

6 REPLIES 6
ballardw
Super User

Easy one first:

Remove date, time and page number from the top of the page.   OPTIONS nonumber nodate ; will turn off those features for all output until you ask for them.

 

Likely easy:

Remove grey border from table, or set color to white.

One way is to use a style that doesn't have outlines

Another is STYLEOVERIDE in a procedure, depending on procedures.

 

You will have to describe what : Implement a half line space between title lines. means in a bit more details.

I can think of different things that fit that text. One is to actually draw some sort of line. Or do you mean to set vertical space as 1.5 lines?

 

 

Cynthia_sas
Diamond | Level 26

Also, changing the margins should be as simple as adding the margin controls to the OPTIONS statement:
options nodate nonumber topmargin=1in bottommargin=1in leftmargin=1in rightmargin=1in;

Cynthia

PhilC
Rhodochrosite | Level 12

I'm finding the places in the documentation that I didn't consider when researching. Thanks.


SAS Dictionary of Printing-Related System Options

PhilC
Rhodochrosite | Level 12

1. Nonumber nodate. Thanks
2a. Using another style means finding another style but I've looked at a gallery (SAS ODS Styles Gallery) all tables have some kind of border.

2b. I'll look into this style overrides more.
3. Yes you're right, "be more specific", lol, I did mean vertical spacing. My theory failed in my attempt to make a 0.5 spaced line using font_size. There's definitely a size limit independent of how small a font_size is provided.

 

 

PhilC
Rhodochrosite | Level 12

I found all my answers in this document.  It was very helpful.

 

"SAS with Style: Creating your own ODS Style Template for RTF Output"  Lauren Haworth, May 2004, Sugi 29.

 

Working with templates is usually never easy, but it ended out being very easy.  I couldn't believe it 

 

Correction: I have updated this so that it conforms with the standard that does not use the deprecated "replace" and instead used "class".

 

ods path reset;
    ods path(REMOVE) SASUSER.templat;
    ods path(PREPEND) Work.templat(update); 

proc template;
  define style Styles.Custom;
    parent = Styles.RTF;
    class fonts /
      'docFont' = ("Arial",11pt) /* Data in table cells */
      ;
    class Table from Output /
      frame = VOID /* outside borders: void, box, above/below, vsides/hsides, lhs/rhs */
      rules = NONE /* internal borders: none, all, cols, rows, groups */
      cellpadding = 2pt /* the space between table cell contents and the cell border */
      cellspacing = 0pt /* the space between table cells, allows background to show */
      borderwidth = 0pt /* the width of the borders and rules */
    ; 
    class Body from Document /
      bottommargin = 1in
      topmargin    = 1in
      rightmargin  = 1in
      leftmargin   = 1in
    ; 
  end;
run;

option nocenter nodate nonumber ;
title;

%let normal=font_size=11pt;
%let answer=[fontweight=bold Leftmargin=0.6in ];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];

ods tagsets.rtf 
  style= Styles.Custom /*Changed*/
  options (
    VSPACE='OFF'
  )
  ;

proc odstext;
  p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
  p " "/style=&Small_line;
  p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
  p " "/style=&Small_line;
  p "Objectives:"/style=&sub_title;
  p;
  p '10A.  Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
  p;
run;

/* ... */

Cynthia_sas
Diamond | Level 26
Hi:
Athough Lauren's paper is an excellent paper, it was written before SAS 9.2 changed the template syntax. The REPLACE statement was deprecated and should no longer be used starting with SAS 9.2. Instead of REPLACE, you should use the CLASS or STYLE statement, as outlined in this paper: https://support.sas.com/resources/papers/proceedings10/033-2010.pdf.
Cynthia

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3749 views
  • 2 likes
  • 3 in conversation