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

LIBNAME MYLIB ‘C:\ODS_TEMPLATES\’;
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 */

  DEFINE STYLE MYLIB.MYSTYLE / STORE=MYLIB.MYSTORE;

  CLASS <STYLE_CLASS_1> /
     <STYLE_ATTRIBUTES_1> = <STYLE_VALUE>
     <STYLE_ATTRIBUTES_2> = <STYLE_VALUE>;

  CLASS <STYLE_CLASS_2> /
     <STYLE_ATTRIBUTES_1> = <STYLE_VALUE>;

 END;

RUN;


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

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

 PARENT=STYLES.PRINTER;

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

 REPLACE FONTS/

 '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); */

 STYLE <STYLE_CLASS_1> FROM <STYLE_CLASS_1> /
   <STYLE_ATTRIBUTE_1> = <STYLE_VALUE>;
 END;

RUN;


ODS PATH MYLIB.MYSTORE (READ) SASHELP.TMPLMST (READ);  

ODS RTF FILE='C:\ODS_RESULTS\Example_1.rtf' STYLE=MYSTYLE;

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

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

** 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;
run;

** 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;
run;

** 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';
run;

______________________________________________

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>

 Body

Overall file colors and fonts, etc.

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

 Heading/Header

Header colors and fonts, etc.

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

 Table

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

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

 Data

Data value colors and fonts, etc.

ex. class data / fontfamily="Palatino";

 Footer

Footer colors and fonts, etc.

ex. class footer / fontweight=bold;

 Fonts

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


TitleFont2

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;
end;
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, Styles.Default.sas

 

SAS Paper

______________________________________________

Journal Style Template - SAS Paper, Styles.Journal.sas

______________________________________________

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