Procedure features: |
BREAK statement options:
|
COMPUTE statement arguments:
| with a computed variable as report-item |
| BEFORE break-variable |
| AFTER
break-variable with conditional logic |
| BEFORE _PAGE_ | |
DEFINE statement options:
|
LINE statement:
| pointer controls |
| quoted text |
| repeating a character string |
| variable values and
formats | |
|
Data set: |
GROCERY
|
Formats: |
$SCTRFMT., $MGRFMT., and $DEPTFMT.
|
The report in this example displays a
record of one day's sales for
each store. The rows are arranged so that all the information about one store
is together, and the information for each store begins on a new page. Some
variables appear in columns. Others appear only in the page header that identifies
the sector and the store's manager.
The header that appears at the top of each page is created with the
_PAGE_ argument in the COMPUTE statement.
Profit is a computed variable based on the value of Sales and Department.
The text that appears at the bottom of the page depends on
the total
of Sales for the store. Only the first two pages of the report appear here.
libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=64 pagesize=30
fmtsearch=(proclib);
![Note about code](../common/images/snbut.gif) | proc report data=grocery nowd
headline headskip;
|
![Note about code](../common/images/snbut.gif) | title 'Sales for Individual Stores'; |
![Note about code](../common/images/snbut.gif) | column sector manager department sales Profit; |
![Note about code](../common/images/snbut.gif) | define sector / group noprint;
define manager / group noprint;
define profit / computed format=dollar11.2;
define sales / analysis sum format=dollar11.2;
define department / group format=$deptfmt.; |
![Note about code](../common/images/snbut.gif) | compute profit;
if department='np1' or department='np2'
then profit=0.4*sales.sum;
else profit=0.25*sales.sum;
endcomp; |
![Note about code](../common/images/snbut.gif) | compute before _page_ / left;
line sector $sctrfmt. ' Sector';
line 'Store managed by ' manager $mgrfmt.;
line ' ';
line ' ';
line ' ';
endcomp; |
![Note about code](../common/images/snbut.gif) | break after manager / ol summarize page;
|
![Note about code](../common/images/snbut.gif) | compute after manager; |
![Note about code](../common/images/snbut.gif) | length text $ 35; |
![Note about code](../common/images/snbut.gif) | if sales.sum lt 500 then
text='Sales are below the target region.';
else if sales.sum ge 500 and sales.sum lt 1000 then
text='Sales are in the target region.';
else if sales.sum ge 1000 then
text='Sales exceeded goal!';
line ' ';
line text $35.;
endcomp;
run; |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.