Usage Note 24536: How do I create multiple summary rows without using a LINE statement?
You can create multiple summary rows by using the BREAK statement on variables that contain the same value for every observation.
Prior to the REPORT procedure, add a new variable in the input dataset for each additional summary row that you want in the report. Assign each new variable the same value for every observation.
In the PROC REPORT code, add each new variable to the beginning of the COLUMN statement. Add a DEFINE statement with either a GROUP or ORDER usage and a NOPRINT option and BREAK AFTER variable_name for each new variable.
Use a COMPUTE AFTER location block to reassign the variable summary values with the desired values. The order of the summary rows is right to left in the COLUMN statement, followed by the RBREAK.
Here is an example of this technique:
DATA example;
INPUT type $ val;
flag1='x';
flag2='y';
DATALINES;
Apples 2
Banana 4
Pears 6
Limes 8
;
RUN;
PROC REPORT NOWD DATA=example;
COL flag1 flag2 type val val=valavg val=valmin;
DEFINE flag1 / GROUP noprint;
DEFINE flag2 / GROUP noprint;
DEFINE val / SUM 'values';
DEFINE valavg / MEAN NOPRINT;
DEFINE valmin / MIN NOPRINT;
BREAK AFTER flag1 / SUMMARIZE;
BREAK AFTER flag2 / SUMMARIZE;
RBREAK AFTER / SUMMARIZE SUPRESS;
COMPUTE AFTER flag2;
type=' MIN:';
val.sum=valmin;
ENDCOMP;
COMPUTE AFTER flag1;
type=' AVG:';
val.sum=valavg;
ENDCOMP;
COMPUTE AFTER;
type=' SUM:';
ENDCOMP;
RUN;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> Procedures ==> REPORT
|
Date Modified: | 2020-04-03 07:21:18 |
Date Created: | 2006-09-08 15:42:39 |