Features: |
BY statement |
SUM statement |
SUMBY statement |
|
Other features: |
SORT procedure |
LABEL statement |
|
Data set: |
EXPREV
|
This example
- creates a separate section of the report for each combination
of state and region
- sums expenses and revenues only for each region and for all regions,
not for individual states.
options nodate pageno=1 linesize=70 pagesize=60;
![Note about code](../common/images/snbut.gif) |
proc sort data=exprev;
by region state;
run; |
![Note about code](../common/images/snbut.gif) | proc print data=exprev noobs;
|
![Note about code](../common/images/snbut.gif) | by region state;
sum revenues expenses;
sumby region;
|
![Note about code](../common/images/snbut.gif) | label region='Sales Region';
|
![Note about code](../common/images/snbut.gif) | format revenues expenses comma10.;
title 'Revenue and Expense Figures for Each Region';
run; |
The report uses default column headers (variable names) because neither
the SPLIT= nor the LABEL option is used. Nevertheless, the BY line at the
top of each section of the report shows the BY variables' labels and their
values. The name of a BY variable identifies the subtotals in the report.
|
|
![[Listing Output]](../common/images/outlist.gif) |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.