Chapter Contents

Previous

Next
The REPORT Procedure

Example 4: Consolidating Multiple Observations into One Row of a Report


Procedure features:
BREAK statement options:
OL
SKIP
SUMMARIZE
SUPPRESS
CALL DEFINE statement
Compute block
associated with a data set variable
COMPUTE statement arguments:
AFTER
a data set variable as report-item
DEFINE statement options:
ANALYSIS
GROUP
SUM
customizing column headers
LINE statement:
quoted text
variable values
Data set: GROCERY
Formats: $MGRFMT. and $DEPTFMT.

This example creates a summary report that







Program

libname proclib 'SAS-data-library';
 Note about code
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib);

proc report data=grocery nowd headline headskip;
 Note about code
   column sector manager sales;
 Note about code
   define sector / group
                   format=$sctrfmt.
                   'Sector';
   define manager / group
                    format=$mgrfmt.
                    'Manager';
   define sales / analysis sum
                  format=comma10.2
                  'Sales';




 Note about code
   break after sector / ol
                        summarize
                        suppress
                        skip;







 Note about code
   compute after;
      line 'Combined sales for the northern sectors were '
            sales.sum dollar9.2 '.';
   endcomp;
 Note about code
   compute sales;
      if _break_ ne ' ' then
      call define(_col_,"format","dollar11.2");
   endcomp;






 Note about code
   where sector contains 'n';
   title 'Sales Figures for Northern Sectors';
run;


Output
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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