Previous Page | Next Page

The REPORT Procedure

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


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.


Program

 Note about code
libname proclib 'SAS-library';
 Note about code
options nodate pageno=1 fmtsearch=(proclib);
 Note about code
ods html body='external-HTML-file';
ods pdf file='external-PDF-file';
ods rtf file='external-RTF-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)=[color=yellow
               fontstyle=italic fontsize=6]
 Note about code
style(column)=[color=moderate brown  
               fontfamily=helvetica fontsize=4]
 Note about code
style(lines)=[color=white backgroundcolor=black
              fontstyle=italic fontweight=bold fontsize=5]
 Note about code
style(summary)=[color=cx3e3d73 backgroundcolor=cxaeadd9 
                fontfamily=helvetica fontsize=3 textalign=r];
 Note about code
   column manager department sales;
 Note about code
   define manager / order
                    order=formatted
                    format=$mgrfmt.
                    'Manager'
 Note about code
                    style(header)=[color=white 
                                   backgroundcolor=black];
 Note about code
   define department / order
                       order=internal
                       format=$deptfmt.
                       'Department'
 Note about code
                       style(column)=[fontstyle=italic];
 Note about code
   break after manager / summarize;
 Note about code
   compute after manager
           / style=[fontstyle=roman fontsize=3 fontweight=bold
             backgroundcolor=white color=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=[backgroundcolor=yellow 
                          fontfamily=helvetica 
                          fontweight=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;
ods pdf close;
ods rtf close;

HTML Body File

                        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.                    

PDF Output

[PDF output]


RTF Output

[RTF output]

Previous Page | Next Page | Top of Page