| Procedure features: | 
| 
 DEFINE statement options: 
 |   
 | 
| Other features: | 
FORMAT procedure
 | 
| Data set: | 
GROCERY
 | 
| Formats: | 
$MGRFMT.
 | 
This example shows how to use formats to control the number of
groups
that PROC REPORT creates. The program creates a format for Department that
classifies the four departments as one of two types: perishable or nonperishable.
Consequently, when Department is an across variable, PROC REPORT creates only
two columns instead of four. The column heading is the formatted value of
the variable.
 
   | 
libname proclib 'SAS-library';  | 
   | 
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib); | 
   | 
proc format;
   value $perish 'p1','p2'='Perishable'
                'np1','np2'='Nonperishable';
run; | 
   | 
proc report data=grocery nowd
     headline
     headskip; | 
   | 
   column manager department,sales sales;  | 
   | 
   define manager / group order=formatted
                    format=$mgrfmt.;
   define department / across order=formatted
                 format=$perish. ''; | 
   | 
   define sales / analysis sum
                  format=dollar9.2 width=13; | 
   | 
   compute after;
      line ' ';
      line 'Total sales for these stores were: '
            sales.sum dollar9.2;
   endcomp; | 
   | 
title 'Sales Summary for All Stores';
run;  | 
                  Sales Summary for All Stores                 1
                                                          
               Nonperishable     Perishable               
      Manager          Sales          Sales          Sales
      ----------------------------------------------------
                                                          
      Adams          $265.00        $430.00        $695.00
      Alomar         $510.00        $276.00        $786.00
      Andrews        $620.00        $425.00      $1,045.00
      Brown          $275.00        $323.00        $598.00
      Jones          $260.00        $370.00        $630.00
      Pelfrey        $465.00        $281.00        $746.00
      Reveiz         $480.00        $630.00      $1,110.00
      Smith          $170.00        $180.00        $350.00
      Taylor         $173.00        $180.00        $353.00
                                                                
          Total sales for these stores were: $6,313.00          
 
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.