SAS ODS Style Template Gallery with over 18 SAS Examples

Below is a collection of SAS ODS Style Templates.  See ODSODS Statistical Graphics, Tables Tip sheet, Style Tip sheet, RTF, PDF, and Reporting Proc Tip sheet.  See also Proc ReportMind Map

ODS Style Definition Selection Process     ODS Table Definition Selection Process 




ODS PATH syntax

ODS PATH MYLIB.MYSTORE (UPDATE) SASHELP.TMPLMST (READ);                                             /* MYSTORE is name of ODS template file */

PROC TEMPLATE;                            /* Create and save new MYSTYLE style from scratch */






PROC TEMPLATE;                         /* Create and save MYSTYLE style by modifying parent */

 DEFINE STYLE MYLIB.MYSTYLE;                                                /* Overwrite default values */


                                                 /* Alternative is EDIT STYLES.PRINTER AS MYLIB.MYSTYLE */


 'TITLEFONT2' = ("Arial', 10pt);      /* Need to include complete list with REPLACE option */

                                                 /* One technique is to copy all FONTS from STYLES.PRINTER and then comment part to change and add replacement */

                                             /* Alternative is STYLE FONTS/'TITLEFONT2' = ("Arial", 10pt); */





** 1. List a particular Template Store;
proc template;
 title '1. List a Particular Template Store';
 list / store=sasuser.templat;

** 2. List a Template Store Folder or Directory;
proc template;
 title '2. List One Template Folder';
 list Base;
 list Styles;
 list Tagsets;
 list StatGraph;

** 3. List a particular Sub-Folder or Template;
proc template;
 title '3. List a particular Sub-Folder or Template';
 list Styles.Default;
 list Base.Contents;
 list Stat.Reg.Graphics;

** 4. Put the Template Source Code in the LOG;
proc template;
 title '4. Put the Template Source Code in the LOG';
 source Styles.Default;
 source Base.Summary;
 source Stat.Reg.Graphics.CooksD;
 source Tagsets.CSV;

** 5. Put the Template Source Code in a file;
proc template;
 title '5. Put the Template Source Code in a file';
 source Styles.Default / file='c:\temp\default.tpl';
 source Base.Summary / file='c:\temp\summary.tpl';


C1. Customizing styles using Proc Template

I. Style Class or Elements, ex. BODY 

II. Style Attributes and Values, ex. FONT_FACE=ARIAL

III. ODS Statement Options, Syntax and ODS ESCAPECHAR

I. Style_Class or Elements - See list of Style Elements

Common <STYLE_CLASS> Brief Description with Examples <STYLE_ATTRIBUTES>=<STYLE_VALUES>


Overall file colors and fonts, etc.

ex. class body / leftmargin = 1.0in color=black fontfamily="Palatino";


Header colors and fonts, etc.

ex. class header / fontweight=bold cellpadding = 0;


Overall table colors, fonts, spacing and frame, etc.

ex. class table / font=fonts('TitleFont') frame=volid rules=groups;


Data value colors and fonts, etc.

ex. class data / fontfamily="Palatino";


Footer colors and fonts, etc.

ex. class footer / fontweight=bold;


Define Overall font name, size, style, etc.

ex. class fonts / 'TitleFont2' = ("Times New Roman", 9pt, Bold);


II. Style Attributes and Values - See list of Style Attributes and ValuesSAS Paper

RTF Destination  Common Style Elements for RTF  ODS RTF Statement 

General Categories: Fonts, Structure and Color

Note that there may be interactions between style attributes such as CELLSPACING=0 may prevent BACKGROUND color from displaying or BORDERWIDTH=0 may prevent the border color from displaying.


Common Font Attributes Brief Description
TitleFont Controls titles, footnotes and generated text


Controls the ‘The XX Procedure’ title

ex. TitleFont2 = ("Times New Roman", 9pt, Bold)

HeadingFont Control table headings and footing fonts
DocFont Controls the display of table cells
Font_Weight, Font_Style, Font_Width  ex. Median, Italic, Normal 
Color  SAS Color code value CX000000 for black, for example

Color code in hex value

Style Attributes lookup on page 296


III. ODS Statement Options, Syntax and ODS ESCAPECHAR

ODS Statement Options and Syntax
BODYTITLE (Note that some issues may be resolved with more recent SAS versions)

Repeat Title , PAGE X of Y, Other, TAGSET.RTF


Page X of Y - Pre SAS V9

"{Page} {\field{\*\fldinst { PAGE }}}\~{of}\~{\field {\*\fldinst { NUMPAGES }}}";

SAS Paper

Page X of Y - SAS V9 ~{pageof}


IV. Custom Style Names - See SAS Paper

proc template;
define style styles.MysansPrinter;
parent = styles.sansPrinter;

style myheader from header /
background = white
font_size = 10pt
just = center;
run; quit;

proc report data=sashelp.class nowindows;
column name age sex height weight;
define name / style(Header)=myheader;
define age / style(Header)=myheader;
run; quit;


Default Style Templates - SAS Paper,


SAS Paper


Journal Style Template - SAS Paper,


Landscape Style Template - SAS Paper


Pharma Style Templates - SAS Paper, Pharma Style


SAS Paper


PROC REPORT - SPANROWS option to repeat across pages, TAGSETS.RTF - SAS Paper





Style Template Examples - SAS Paper


Data _Null_ Style Template - SAS Paper


Custom Table Template - See Paper, Custom Proc Freq

Powered by Wild Apricot Membership Software