Previous Page | Next Page

The REPORT Procedure

Example 2: Ordering the Rows in a Report


Procedure features:

PROC REPORT statement options:

COLWIDTH=

HEADLINE

HEADSKIP

SPACING=

BREAK statement options:

OL

SKIP

SUMMARIZE

COMPUTE statement arguments:

AFTER

DEFINE statement options:

ANALYSIS

FORMAT=

ORDER

ORDER=

SUM

ENDCOMP statement

LINE statement:

with quoted text

with variable values

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

This example


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
            colwidth=10
            spacing=5
            headline headskip;
 Note about code
   column manager department sales;
 Note about code
   define manager / order order=formatted format=$mgrfmt.;
   define department / order order=internal format=$deptfmt.;
 Note about code
   define sales / analysis sum format=dollar7.2;
 Note about code
   break after manager / ol
                         summarize
                         skip;
 Note about code
   compute after;
      line 'Total sales for these stores were: '
           sales.sum dollar9.2;
   endcomp;
 Note about code
   where sector='se';
 Note about code
   title 'Sales for the Southeast Sector';
 run;

Output

                 Sales for the Southeast Sector                1

               Manager     Department       Sales
               ----------------------------------
                                                 
               Jones       Paper           $40.00
                           Canned         $220.00
                           Meat/Dairy     $300.00
                           Produce         $70.00
               -------                    -------
               Jones                      $630.00
                                                 
               Smith       Paper           $50.00
                           Canned         $120.00
                           Meat/Dairy     $100.00
                           Produce         $80.00
               -------                    -------
               Smith                      $350.00
                                                 
          Total sales for these stores were:   $980.00          

Previous Page | Next Page | Top of Page