Chapter Contents

Previous

Next
The REPORT Procedure

Example 16: Specifying Style Elements for HTML Output in Multiple Statements


Procedure features:
STYLE= option in
PROC REPORT statement
CALL DEFINE statement
COMPUTE statement
DEFINE statement
Other features: ODS HTML statement
Data set: GROCERY
Formats: $MGRFMT. and $DEPTFMT.

This example creates HTML 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.


Program

libname proclib 'SAS-data-library';
options nodate fmtsearch=(proclib);
 Note about code
ods html body='external-file';
 Note about code
proc report data=grocery nowd headline headskip
 Note about code
style(report)=[cellspacing=5 borderwidth=10 bordercolor=blue]
 Note about code
style(header)=[foreground=yellow font_face=lucida
               font_style=italic font_size=6]
 Note about code
style(column)=[foreground=moderate brown  
               font_face=helvetica font_size=4]
 Note about code
style(lines)=[foreground=white background=black font_face=lucida
              font_style=italic font_weight=bold font_size=5]
 Note about code
style(summary)=[foreground=cx3e3d73 background=cxaeadd9 
                font_face=helvetica font_size=3 just=r];
 Note about code
   column manager department sales;
 Note about code
   define manager / order
                    order=formatted
                    format=$mgrfmt.
                    'Manager'
 Note about code
                    style(header)=[foreground=white 
                                   background=black];
 Note about code
   define department / order
                       order=internal
                       format=$deptfmt.
                       'Department'
 Note about code
                       style(column)=[font_style=italic];
 Note about code
   break after manager / summarize;
 Note about code
   compute after manager
           / style=[font_style=roman font_size=3 font_weight=bold
             background=white foreground=black];
 Note about code
      line 'Subtotal for ' manager $mgrfmt. 'is ' 
            sales.sum dollar7.2 '.';
   endcomp;
 Note about code
   compute sales;
      if sales.sum>100 and _break_=' ' then
      call define(_col_, "style", 
                  "style=[background=yellow 
                          font_face=helvetica 
                          font_weight=bold]");
   endcomp;
 Note about code
   compute after;
       line 'Total for all departments is: '
            sales.sum dollar7.2 '.';
   endcomp;
 Note about code
   where sector='se';
 Note about code
   title 'Sales for the Southeast Sector';
run;
 Note about code
ods html close;


HTML Body File
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.