styles in report with odspeople.uncw.edu/blumj/stt305/ppt/styles in report with ods.pdfstyle...

22
Styles in REPORT with ODS

Upload: others

Post on 12-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Styles in REPORT with ODS

Page 2: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 3: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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;

Page 4: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 5: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 6: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Result

Page 7: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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”

Page 8: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 9: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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 ###%

Page 10: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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

Page 11: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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;

Page 12: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 13: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 14: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 15: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Result

Page 16: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 17: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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;

Page 18: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 19: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

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.

Page 20: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Result

Page 21: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Exercise (Uses Exercise 3 from

PROC REPORT Lesson)

Page 22: Styles in REPORT with ODSpeople.uncw.edu/blumj/stt305/ppt/Styles in REPORT with ODS.pdfStyle Definitions in REPORT • Some things you can modify –font_face • Sets the font for

Exercise (Uses Exercise 1 from

Across Variable Lesson)