reporting styles
reporting procedure styles Tip Sheet Reporting Procedure Styles Tip Sheet ReportingProcedure ProcedureStyles StylesTip TipSheet Sheet Reporting PROC TEMPLATE Table Styles PROCTEMPLATE TEMPLATETable TableStyles Styles PROC PROC TEMPLATE tables apply style overrides PROC TEMPLATE tables apply style overrides PROC TEMPLATE tables apply style overrides within the table, column, header, and footer within the table, column, header, and footer within the table, column, header, and footer definitions. definitions. definitions. proc template; proc template; proc template; define table table; define table table; define table table; style=style-override; style=style-override; style=style-override; define header table-header; define header table-header; define header table-header; style=style-override; style=style-override; style=style-override; end; end; end; define column column; define column column; define column column; style=style-override; style=style-override; style=style-override; define header col-header; define header col-header; define header col-header; style=style-override; style=style-override; style=style-override; end; end; end; header=col-header; header=col-header; header=col-header; end; end; end; define footer table-footer; define footer table-footer; define footer table-footer; style=style-override; style=style-override; style=style-override; end; end; end; end; end; end; run; run; run;
PROC FREQ Crosstabs Styles PROCFREQ FREQCrosstabs CrosstabsStyles Styles PROC PROC FREQ Crosstabs are applied based PROC FREQ Crosstabs are applied atable table based PROC FREQ Crosstabs are applied tototo a atable based on style overrides in the header, footer, and style overrides header, footer, onon style overrides in in thethe header, footer, andand cellvalue templates well specialized attributes. cellvalue templates well specialized attributes. cellvalue templates asasas well asasas specialized attributes.
Reporting Reporting Reporting Procedure Procedure Procedure Styles Styles Styles Tip Sheet TipSheet Sheet Tip
proc template; proc template; proc template; define crosstabs Base.Freq.CrosstabFreqs; define crosstabs Base.Freq.CrosstabFreqs; define crosstabs Base.Freq.CrosstabFreqs; define header table-header; define header table-header; define header table-header; style=style-override; style=style-override; style=style-override; end; end; end; define footer table-footer; define footer table-footer; define footer table-footer; style=style-override; style=style-override; style=style-override; end; end; end; style=style-override; style=style-override; style=style-override; cell_style=style-override; cell_style=style-override; cell_style=style-override; row_var_style=style-override; row_var_style=style-override; row_var_style=style-override; col_var_style=style-override; col_var_style=style-override; col_var_style=style-override; row_total_style=style-override; row_total_style=style-override; row_total_style=style-override; col_total_style=style-override; col_total_style=style-override; col_total_style=style-override; grand_total_style=style-override; grand_total_style=style-override; grand_total_style=style-override; legend_style=style-override; legend_style=style-override; legend_style=style-override; cols_header=col-header; cols_header=col-header; cols_header=col-header; rows_header=row-header; rows_header=row-header; rows_header=row-header; end; end; end; run; run; run;
This sheet places frequently used This tip sheet places frequently used This tiptip sheet places frequently used information one place, one sheet information one place, on one sheet of information ininin one place, onon one sheet ofof paper, you don’t have search through the paper, so you don’t have to search through the paper, soso you don’t have toto search through the online documentation. gives you online documentation. Italso also gives you online documentation. ItItalso gives you something take home, type and try. something to take home, type in, and try. something toto take home, type in,in, and try.
The style= attribute the crosstabs template The style= attribute the crosstabs template The style= attribute ininin the crosstabs template controls the overall table. The style= the colcontrols the overall table. The style= the colcontrols the overall table. The style= ininin the colheader and row-header templates controls those header and row-header templates controls those header and row-header templates controls those areas. areas. areas.
table table table table-header table-header table-header
®
® ®reporting procedures, PROC The Base SAS The Base SAS reporting procedures, PROC The Base SAS reporting procedures, PROC PRINT, PROC REPORT, PROC TABULATE, PROC PRINT, PROC REPORT, PROC TABULATE, PROC PRINT, PROC REPORT, PROC TABULATE, PROC TEMPLATE Tables, and PROC FREQ Crosstabs, TEMPLATE Tables, and PROC FREQ Crosstabs, TEMPLATE Tables, and PROC FREQ Crosstabs, enable you quickly analyze and organize enable you to quickly analyze and organize enable you toto quickly analyze and organize your data into easy-to-read tables. Adding your data into easy-to-read tables. Adding your data into easy-to-read tables. Adding styles your reports can give them another styles to your reports can give them another styles toto your reports can give them another dimension expression and usability. This dimension of expression and usability. This tip dimension ofof expression and usability. This tiptip sheet presents the basics adding style sheet presents the basics of adding style to sheet presents the basics ofof adding style toto your Base SAS reporting procedures output. your Base SAS reporting procedures output. your Base SAS reporting procedures output.
crosstabs crosstabs crosstabs table-header table-header table-header
col-header col-header col-header col-header col-header col-header col-header col-header col-header column column column
column column column
column column column
column column column
column column column
column column column
column column column
column column column
column column column
column column column
column column column
column column column
table-footer table-footer table-footer
Column for logo, address, and trademark info. Column for logo, address, and trademark info. Column for logo, address, and trademark info.
col-header col-header col-header row-header row-header row-header col_var_style col_var_style col_var_style col_var_style col_var_style col_var_style
col-header col-header col-header
row_var_style row_var_style row_var_style
cell_style cell_style cell_style
cell_style cell_style cell_style
row_total_style row_total_style row_total_style
row_var_style row_var_style row_var_style
cell_style cell_style cell_style
cell_style cell_style cell_style
row_total_style row_total_style row_total_style
row-header col_total_style col_total_style grand_total_style row-header col_total_style col_total_style col_total_style col_total_style grand_total_style grand_total_style row-header table-footer table-footer table-footer
SAS Institute Inc. World Headquarters +1 919 677For 8000 www.sas.com/offices complete information refer
the complete information refer the ForFor complete information refer tototo the Base SAS 9.2 documentation at Base SAS9.29.2 documentation Base SAS documentation at at http://support.sas.com/v9doc http://support.sas.com/v9doc http://support.sas.com/v9doc
SAS and all other SAS Institute Inc. product ® ®®or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies. Copyright © 2008, SAS Institute Inc. All rights reserved. 479387_01.08
Reporting Reporting Reporting Procedure Procedure ProcedureStyles Styles Styles Tip Tip TipSheet Sheet Sheet reporting procedure styles Tip Sheet Terms Terms Terms
style style styleattribute attribute attribute AAAname-value name-value name-valuepair pair pairthat that thatdescribes describes describesaaasingle single singlebehavioral behavioral behavioral or ororvisual visual visualaspect aspect aspectof ofofaaapiece piece pieceof ofofoutput. output. output. style style styleelement element element AAAnamed named namedcollection collection collectionof ofofstyle style styleattributes attributes attributesspecified specified specifiedby by by the the theSTYLE STYLE STYLEor ororCLASS CLASS CLASSstatement statement statementin ininPROC PROC PROC TEMPLATE TEMPLATE TEMPLATEstyle style styletemplates. templates. templates.Each Each Eacharea area areain ininaaapiece piece pieceof ofof ODS ODS ODSoutput output outputhas has hasaaastyle style styleelement element elementname name nameassociated associated associated with with withitititwhere where wherethe the theattributes attributes attributeswill will willbe be beapplied. applied. applied.
Style Style StyleOverrides Overrides Overrides Style Style Styleoverrides, overrides, overrides,specified specified specifiedby by bystyle-override style-override style-overridein ininthe the the rest rest restof ofofthis this thistip tip tipsheet, sheet, sheet,allow allow allowyou you youto totooverride override overridethe the the default default defaultstyle style styleelement element elementname name nameand and andattributes attributes attributesin ininaaa particular particular particulararea area areaof ofofaaareport. report. report.While While Whileeach each eachprocedure procedure procedure uses uses usesaaaslightly slightly slightlydifferent different differentway way wayto totoapply apply applyoverrides, overrides, overrides,the the the style style styleoverrides overrides overridesthemselves themselves themselvesalways always alwayshave have havethe the the following following followingform. form. form.Both Both Bothstyle-element style-element style-elementand and andstylestylestyleattributes attributes attributesare are areoptional. optional. optional. or oror or
style-element{style-attributes}; style-element{style-attributes}; style-element{style-attributes}; style-element{style-attributes}; style-element[style-attributes]; style-element[style-attributes]; style-element[style-attributes]; style-element[style-attributes];
style-element style-element style-element Specifies Specifies Specifiesthe the thename name nameof ofofthe the thestyle style styleelement element elementto totouse use use instead instead insteadof ofofthe the thedefault. default. default.Typical Typical Typicalstyle style styleelements elements elementsare are are Data, Data, Data,Table, Table, Table,Header, Header, Header,but but butcustom custom customstyle style styleelements elements elementscan can can be be beused used usedas asaswell. well. well. style-attributes style-attributes style-attributes Specifies Specifies Specifiesaaaspace space spacedelimited delimited delimitedlist list listof ofofstyle style styleattributes. attributes. attributes. Typical Typical Typicalstyle style styleattributes attributes attributesare are arecolor=red color=red color=redand and and ®®® ® fontfamily=“Arial”. fontfamily=“Arial”. fontfamily=“Arial”.AAASAS SAS SAS format format formatcan can canalso also alsobe be be used used usedas asasan an anattribute attribute attributevalue value valuefor for forconditional conditional conditionalformatting formatting formatting (e.g., (e.g., (e.g.,backgroundcolor=$bgcolor.). backgroundcolor=$bgcolor.). backgroundcolor=$bgcolor.).When When WhenaaaSAS SAS SAS format format formatisisisused, used, used,the the thevalue value valueof ofofthe the thecurrent current currentdata data datacell cell cellisisis evaluated evaluated evaluatedagainst against againstthe the theformat format formatto totodetermine determine determinethe the the attribute’s attribute’s attribute’svalue. value. value.
PROC PROC PROCPRINT PRINT PRINTStyles Styles Styles PROC PROC PROCPRINT PRINT PRINTstyles styles stylesare are areapplied applied appliedto totoaaatable table tablebased based basedon on on named named namedregions regions regionsin ininthe the thetable. table. table. proc proc proc procprint print print printstyle(table-area)=style-override style(table-area)=style-override style(table-area)=style-override style(table-area)=style-override … …… … ;;;; var var var var////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; id id id id////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; sum sum sum sum////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; run; run; run; run;
PROC PROC PROCREPORT REPORT REPORTStyles Styles Styles PROC PROC PROCREPORT REPORT REPORTstyles styles stylesare are areapplied applied appliedto totoaaatable table tablebased based based on on onnamed named namedregions regions regionsin ininthe the thetable. table. table. proc proc proc procreport report report reportstyle(table-area)=style-override style(table-area)=style-override style(table-area)=style-override style(table-area)=style-override … …… … ;;;; define define define define…………////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; break break break break…………////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; rbreak rbreak rbreak rbreak…………////style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; style(table-area)=style-override; compute compute compute compute…………////style=style-override; style=style-override; style=style-override; style=style-override; run; run; run; run;
All All Allnames names namesfrom from fromthe the thetable table tablebelow below belowcan can canbe be beused used usedin ininplace place place of ofoftable-area table-area table-areaon on onthe the thePROC PROC PROCstatement. statement. statement.The The TheVAR VAR VARand and and ID ID IDstatements statements statementsaccept accept acceptcolumn column columnand and andheader header header ..The .The TheSUM SUM SUM statement statement statementaccepts accepts acceptscolumn column column ,,grandtotal ,grandtotal grandtotal ,,header ,header header ,,and ,and and total total total .. .
All All Allnames names namesfrom from fromthe the thetable table tablebelow below belowcan can canbe be beused used usedin ininplace place place of ofoftable-area table-area table-areaon on onthe the thePROC PROC PROCstatement. statement. statement.The The TheDEFINE DEFINE DEFINE statement statement statementaccepts accepts acceptscolumn column columnand and andheader header header ..The .The TheBREAK BREAK BREAK and and andRBREAK RBREAK RBREAKstatements statements statementsaccept accept acceptsummary summary summaryand and andlines lines lines .. .
Style Style Styleoverrides overrides overridesgiven given givenon on onstatements statements statementstake take takeprecedence precedence precedence over over overthose those thosegiven given givenon on onthe the thePROC PROC PROCstatement. statement. statement.
Style Style Styleoverrides overrides overridesgiven given givenon on onthe the thestatements statements statementstake take take precedence precedence precedenceover over overthose those thosegiven given givenon on onthe the thePROC PROC PROC statement. statement. statement.
PROC PROC PROCTABULATE TABULATE TABULATEstyles styles stylesare are areapplied applied appliedto totoaaatable table table based based basedon on onthe the thestatements statements statementsthat that thatcreate create createthe the thetable. table. table. proc proc proc proctabulate tabulate tabulate tabulatestyle=style-override style=style-override style=style-override style=style-override … …… … ;;;; class class class class…………////style=style-override; style=style-override; style=style-override; style=style-override; classlev classlev classlev classlev…………////style=style-override; style=style-override; style=style-override; style=style-override; var var var var…………////style=style-override; style=style-override; style=style-override; style=style-override; keyword keyword keyword keyword…………////style=style-override; style=style-override; style=style-override; style=style-override; table table table table…………all*{style=style-override} all*{style=style-override} all*{style=style-override} all*{style=style-override}………… …………x*{style=style-override} x*{style=style-override} x*{style=style-override} x*{style=style-override}………… ////style=style-override style=style-override style=style-override style=style-override misstext={style=style-override} misstext={style=style-override} misstext={style=style-override} misstext={style=style-override} box={style=style-override}; box={style=style-override}; box={style=style-override}; box={style=style-override}; run; run; run; run;
table table table
report report report
obsheader obsheader obsheader
header header header
header header header
header header header
header header header
header header header
obs obs obs
column column column
column column column
column column column
column column column
column column column
obs obs obs
column column column
column column column
column column column
column column column
column column column
obs obs obs
column column column
column column column
obs obs obs
column column column
column column column
obs obs obs
column column column
column column column
bylabel bylabel bylabel
total total total
total total total
grandtotal grandtotal grandtotal
grandtotal grandtotal grandtotal
grandtotal grandtotal grandtotal
nnn
PROC PROC PROCTABULATE TABULATE TABULATEStyles Styles Styles
summary summary summary
summary summary summary
summary summary summary
lines lines lines
Any Any Anystyles styles stylesfor for forvariables variables variablesin ininthe the theCLASS, CLASS, CLASS, CLASSLEV, CLASSLEV, CLASSLEV,VAR, VAR, VAR,and and andKEYWORD KEYWORD KEYWORDstatements statements statementscan can can be be beoverridden overridden overriddenin ininthe the theTABLE TABLE TABLEstatement. statement. statement.This This Thisallows allows allows you you youto totohave have havedifferent different differentstyle style stylebehavior behavior behaviorwith with withmultiple multiple multiple TABLE TABLE TABLEstatements. statements. statements. table table table table…………var-or-stat={style=style-override} var-or-stat={style=style-override} var-or-stat={style=style-override} var-or-stat={style=style-override}…………;;;;
table table table box box box
column column column
column column column
column column column
column column column
column column column
summary summary summary
summary summary summary
summary summary summary
var var var
keyword keyword keyword keyword keyword keyword class class class
column column column
var var var
class class class proc proc//x/xx proc proc proc//x/xx classlev classlev classlev proc
proc proc//x/xx proc proc proc//x/xx classlev classlev classlev classlev classlev classlev proc
lines lines lines lines lines lines
keyword keyword keyword
all all all//x/xx
all all all//x/xx