Previous Page | Next Page

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 headings

LINE statement:

quoted text

variable values

Data set: GROCERY
Formats: $MGRFMT. and $DEPTFMT.

This example creates a summary report that


Program

 Note about code
libname proclib 'SAS-library';
 Note about code
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib);
 Note about code
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';
 Note about code
   title 'Sales Figures for Northern Sectors';
run;

Output

               Sales Figures for Northern Sectors              1

                 Sector     Manager       Sales
                 ------------------------------
                                               
                 Northeast  Alomar       786.00
                            Andrews    1,045.00
                                     ----------
                                      $1,831.00
                                               
                 Northwest  Brown        598.00
                            Pelfrey      746.00
                            Reveiz     1,110.00
                                     ----------
                                      $2,454.00
                                               
    Combined sales for the northern sectors were $4,285.00.     

Previous Page | Next Page | Top of Page