styles in report with odspeople.uncw.edu/blumj/stt305/ppt/styles in report with ods.pdfstyle...
TRANSCRIPT
Styles in REPORT with ODS
ODS File Types
• ODS (Output Delivery System) can be used to deliver output to files of various types.
• Syntax:
ods filetype file=‘file-specification’;
…SAS code…
ods filetype close;
• All output generated between the two ODS statements is delivered to the file. Types available include: RTF, PDF and HTML.
Example
• Consider the following (an example from a previous lesson on report):
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd;
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol skip;
rbreak after / summarize dol;
run;
ods pdf close;
Example
• Consider the following (an example from a previous lesson on report):
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd;
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol skip;
rbreak after / summarize dol;
run;
ods pdf close;
Output between these will be delivered
to the file specified. Since it is not full-
path, it will be stored in the working
directory.
Example
• Consider the following (an example from a previous lesson on report):
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd;
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol skip;
rbreak after / summarize dol;
run;
ods pdf close;
Match the file extension and file type.
Result
Style Definitions in REPORT
• Style definitions allow you to modify things such
as background colors, fonts, font sizes and more.
• Style definitions can be made in PROC REPORT
in several places:
– In the PROC REPORT line.
– In DEFINE statements (after the slash).
– In BREAK and RBREAK statements (after the slash)
• Syntax
style(location)=[style-element=value …]
– The location specification is “optional”
Style Definitions in REPORT
• In the PROC REPORT line, the following locations
are available:
– header
• Changes the style of all headers (column labels)
– column
• Changes the style of all entries in all columns
– summary
• Changes the style of all summaries produced by break and
rbreak commands
– report
• Changes the style of the table—border width, color and
such.
Style Definitions in REPORT
• Some things you can modify– font_face
• Sets the font for the text (value must be a quoted font name)
– foreground
• Sets the text color
– background
• Sets the table cell color
– font_size
• Sets text size– Whole number 1 through 7
– Point size specification: ##pt
– Percent specification ###%
Style Definitions in REPORT
• More things you can modify
– font_weight
• Generally used if you want to set the font to bold
– font_style
• Generally used if you want to set the font to italic
– borderwidth
• Sets width of borders
– bordercolor
• Sets border color
Example
• Consider the following modifications to the previous:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress;
rbreak after / summarize dol;
run;
ods pdf close;
Example
• Consider the following modifications to the previous:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress;
rbreak after / summarize dol;
run;
ods pdf close;
Applies to column headers.
Example
• Consider the following modifications to the previous:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress;
rbreak after / summarize dol;
run;
ods pdf close;
Applies to data in the columns.
Example
• Consider the following modifications to the previous:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group;
define pol_type/'Pollutant' group width=10;
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress;
rbreak after / summarize dol;
run;
ods pdf close;
Applies to all break lines.
Result
Style Definitions in REPORT
• In the DEFINE statement, the following locations are used:– header
• Changes the style of the header for that variable
– column
• Changes the style of all entries for that variable
• In the BREAK and RBREAK statements, no location is specified—style definitions are applied to the row.
• Style definitions made in DEFINE, BREAK and RBREAK statements override those made in the PROC REPORT line.
Example
• Consider:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group style(header)=[background=white foreground=black]style(column)=[background=cxEEEEEE];
define pol_type/'Pollutant' group width=10 style(column)=[background=cxDDDDDD];
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress style=[font_size=12pt font_face='Georgia'];
rbreak after / summarize dol;
run;
ods pdf close;
Example
• Consider:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group style(header)=[background=white foreground=black]style(column)=[background=cxEEEEEE];
define pol_type/'Pollutant' group width=10 style(column)=[background=cxDDDDDD];
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress style=[font_size=12pt font_face='Georgia'];
rbreak after / summarize dol;
run;
ods pdf close;
Changes made in a
define statement apply to
that column.
Both header and column
are available here, these
attributes override any set
at the top.
Example
• Consider:
Title 'Job Costs';
options nodate pageno=1;
ods pdf file='Example 1.pdf';
proc report data=mysas.projects nowd
style(header)=[background=black foreground=white font_face='Papyrus']
style(column)=[background=grayCC font_face='Arial']
style(summary)=[font_weight=bold font_size=14pt];
column Region Pol_type JobTotal=num JobTotal=avg JobTotal=med JobTotal=std;
define region/'Regional Office' group style(header)=[background=white foreground=black]style(column)=[background=cxEEEEEE];
define pol_type/'Pollutant' group width=10 style(column)=[background=cxDDDDDD];
define num/n 'Number of Jobs' width=8;
define avg/mean 'Mean Total Cost' format=dollar12.2;
define med/median 'Median Total Cost' format=dollar12.2;
define std/std 'Std. Deviation of Total Cost' format=dollar12.2;
break after region/summarize ol suppress style=[font_size=12pt font_face='Georgia'];
rbreak after / summarize dol;
run;
ods pdf close;
Changes made in a
break or rbreak apply to
all rows generated by
that break command.
No location is available here.
Result
Exercise (Uses Exercise 3 from
PROC REPORT Lesson)
Exercise (Uses Exercise 1 from
Across Variable Lesson)