Procedure features: |
COLUMN statement
arguments:
|
PCTSUM |
|
SUM |
|
spanning headings | |
COMPUTE statement options:
|
DEFINE statement options:
|
RBREAK statement options:
|
|
Other features: |
|
Data set: |
GROCERY
|
Formats: |
$MGRFMT. and $DEPTFMT.
|
The summary report in this example shows the total
sales for each store
and the percentage that these sales represent of sales for all stores. Each
of these columns has its own heading. A single heading also spans all the
columns. This heading looks like a title, but it differs from a title because
it would be stored in a report definition. You must submit a null TITLE statement
whenever you use the report definition, or the report will contain both a
title and the spanning heading.
The report includes a computed character variable, COMMENT, that flags
stores with an unusually high percentage of sales. The text of COMMENT wraps
across multiple rows. It makes sense to compute COMMENT only for individual
stores. Therefore, the compute block that does the calculation includes conditional
code that prevents PROC REPORT from calculating COMMENT on the summary line.
|
libname proclib 'SAS-library'; |
|
options nodate pageno=1 linesize=64 pagesize=60
fmtsearch=(proclib); |
|
proc report data=grocery nowd headline;
title; |
|
column ('Individual Store Sales as a Percent of All Sales'
sector manager sales,(sum pctsum) comment); |
|
define manager / group
format=$mgrfmt.;
define sector / group
format=$sctrfmt.;
define sales / format=dollar11.2
'';
define sum / format=dollar9.2
'Total Sales'; |
|
define pctsum / 'Percent of Sales' format=percent6. width=8;
define comment / computed width=20 '' flow; |
|
compute comment / char length=40; |
|
if sales.pctsum gt .15 and _break_ = ' '
then comment='Sales substantially above expectations.';
else comment=' ';
endcomp; |
|
rbreak after / ol summarize;
run; |
1
Individual Store Sales as a Percent of All Sales
Total Percent
Sector Manager Sales of Sales
-------------------------------------------------------------
Northeast Alomar $786.00 12%
Andrews $1,045.00 17% Sales substantially
above expectations.
Northwest Brown $598.00 9%
Pelfrey $746.00 12%
Reveiz $1,110.00 18% Sales substantially
above expectations.
Southeast Jones $630.00 10%
Smith $350.00 6%
Southwest Adams $695.00 11%
Taylor $353.00 6%
--------- --------
$6,313.00 100%
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.