SUMBY and SUMTYPE - Controlling Summarization

MICS summarization facilities are used to preprocess the files used by the report programs.
micsrm140
These facilities require that a data element be defined as a control break variable, and that the summarized files be sorted so the break variable is last in the sort key list. A single summarized observation is then written from multiple observations, with the same break variable value, whenever the break variable value changes. In addition to identifying the data element, you can also control how it is used to create the sort key list.
For example, you may want to generate a report from the last three cycles of the DETAIL timespan and summarize the information by HOUR. As it stands, this report request would be ambiguous. Do you want each hour of each day reported separately, or do you want the same hour of all days included in the input data to be summarized together? The postprocessor reports allow either method.
The summarization data element is defined by means of a SAS global variable assignment statement. The statement is required and must be present after the CONTROL DD * statement in the report JCL.
The format of the statement is:
%LET SUMBY = data-element-name;
The data element name must be one of the following:
  • STARTTS
  • HOUR
  • ZONE
  • DAY
  • WEEK
  • MONTH
  • YEAR
  • SYSID
Any other specification will result in a control statement error and an aborted report run.
The summarization technique is defined by means of another SAS global variable assignment statement. The statement is not required, but, if present, must be included after the CONTROL DD * statement in the report JCL. The statement can be either of the following:
%LET SUMTYPE = DETAIL; %LET SUMTYPE = COMPOSITE;
The specification of COMPOSITE forces ALL occurrences of the same value of the SUMBY variable to be summarized and reported together. DETAIL, on the other hand, will cause the input files to be processed and reported in date/time order. In the previous example, the sort key lists would be:
SYSID HOUR (COMPOSITE) SYSID YEAR MONTH DAY HOUR (DETAIL)
DETAIL is the default, so unless COMPOSITE summarization is required, the statement can be omitted. Note that a change in the value of SYSID always forces a control break.
In addition, remember that some combinations of database timespans and summarization elements are not valid. For example, although STARTTS is present in all timespans, it can be used as the summarization element only for the DETAIL timespan. Also, the data element WEEK is not present in the MONTHS timespan, so this combination will not be processed.
An invalid combination will result in a control statement error and an aborted report run.
Examples:
1. %LET SUMBY = HOUR; %LET SUMTYPE = COMPOSITE; 2. %LET SUMBY = HOUR; %LET SUMTYPE = DETAIL;
In example 1, if three cycles of the DETAIL timespan were also specified, this combination would result in a report with 24 control breaks. Hour 0 of each of the three days (the hour from midnight to 1 a.m.) would be summarized together into a single report, as would hours 1, 2, and so on. Example 2, assuming the same cycle and timespan specifications, would result in a report with 72 control breaks. Each hour of the day in the first cycle would be reported, followed by each hour of the day in the second cycle, followed by the same for the third cycle.