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 header is the formatted value of the
variable.
libname proclib 'SAS-data-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; |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.