Procedure features: |
STYLE=
option in
|
PROC REPORT statement |
|
CALL DEFINE statement |
|
COMPUTE statement |
|
DEFINE
statement | |
|
Other features: |
ODS HTML statement |
ODS PDF statement |
ODS RTF statement |
|
Data set: |
GROCERY
|
Formats: |
$MGRFMT. and $DEPTFMT.
|
This example creates HTML, PDF, and RTF files and sets the style elements
for each location in the report in the PROC REPORT statement. It then overrides
some of these settings by specifying style elements in other statements.
|
libname proclib 'SAS-library'; |
|
options nodate pageno=1 fmtsearch=(proclib); |
|
ods html body='external-HTML-file';
ods pdf file='external-PDF-file';
ods rtf file='external-RTF-file'; |
|
proc report data=grocery nowd headline headskip |
|
style(report)=[cellspacing=5 borderwidth=10 bordercolor=blue] |
|
style(header)=[color=yellow
fontstyle=italic fontsize=6] |
|
style(column)=[color=moderate brown
fontfamily=helvetica fontsize=4] |
|
style(lines)=[color=white backgroundcolor=black
fontstyle=italic fontweight=bold fontsize=5] |
|
style(summary)=[color=cx3e3d73 backgroundcolor=cxaeadd9
fontfamily=helvetica fontsize=3 textalign=r]; |
|
column manager department sales; |
|
define manager / order
order=formatted
format=$mgrfmt.
'Manager' |
|
style(header)=[color=white
backgroundcolor=black]; |
|
define department / order
order=internal
format=$deptfmt.
'Department' |
|
style(column)=[fontstyle=italic]; |
|
break after manager / summarize; |
|
compute after manager
/ style=[fontstyle=roman fontsize=3 fontweight=bold
backgroundcolor=white color=black]; |
|
line 'Subtotal for ' manager $mgrfmt. 'is '
sales.sum dollar7.2 '.';
endcomp; |
|
compute sales;
if sales.sum>100 and _break_=' ' then
call define(_col_, "style",
"style=[backgroundcolor=yellow
fontfamily=helvetica
fontweight=bold]");
endcomp; |
|
compute after;
line 'Total for all departments is: '
sales.sum dollar7.2 '.';
endcomp; |
|
where sector='se'; |
|
title 'Sales for the Southeast Sector';
run; |
|
ods html close;
ods pdf close;
ods rtf close; |
Sales for the Southeast Sector 1
Manager Department Sales
------------------------------
Jones Paper 40
Canned 220
Meat/Dairy 300
Produce 70
Jones 630
Subtotal for Jones is $630.00.
Smith Paper 50
Canned 120
Meat/Dairy 100
Produce 80
Smith 350
Subtotal for Smith is $350.00.
Total for all departments is: $980.00.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.