

Common Techniques Used In Reporting › 5.5 Using Summarization › 5.5.2 Defining a File Summarization Process
5.5.2 Defining a File Summarization Process
The steps involved in defining a summarization process are as
follows (assuming that the user has already identified the
files to be processed):
1. Determine the level of summarization to be performed.
2. Determine if the input data is in the right sequence.
3. Define the SAS statements to invoke file summary.
Determine the Level of Summarization to be Performed
----------------------------------------------------
First be sure that the timespan closest to the level of
summarization required has been selected for the file. At
times, you might find out that the desired level of
summarization for the file is available in a higher timespan.
Consider the following example to illustrate this point. You
must report on the resource consumption of a given batch user
on a year-to-date basis. This might lead you to select the
Batch User Activity file in the MONTHS timespan, select only
months within the current year, and then summarize this data
for the year. The same file in the YEARS timespan, however,
is already summarized to the year and may be directly
processed, without requiring summarization.
Assuming that summarization will be required, you must
determine the level of summarization. To do this, simply
write down the variables from major to minor in order of
importance, the same as you would if you were defining a sort
operation. For example, the summarization of the CPU
Activity File in the DAYS timespan, so that the total
activity was summarized for a day, would be based on the
following variables:
SYSID YEAR MONTH DAY
Note: All variables in the summarization pattern must be
specified. DAY by itself would not be correct.
Determine if the Input Data is in the Right Sequence
----------------------------------------------------
The summarization defined above requires that the input data
be sorted in that sequence. If the files are in that
sequence, no sort is required. If not, you must sort the file
prior to using the CA MICS summarization facility.
Define the SAS Statements to Invoke File Summary
------------------------------------------------
Here is a typical summarization program:
%LET BY = variable-summarization-list ;
%LET BREAK = most-minor-summarization-variable;
PROC SORT DATA=input-file OUT=sorted-file; BY &BY;
DATA output-file;
SET sorted-file;
%fffSUM;
The following must be defined:
o variable-summarization-list
o most-minor-summarization-variable
o input-file
o sorted-file
o output-file
o fff
The code would be as follows:
%LET BY = SYSID YEAR MONTH DAY ;
%LET BREAK = DAY ;
PROC SORT DATA=&PCPUD..HARCPU01 OUT=CPUSORT; BY &BY;
DATA CPUBYDA;
SET CPUSORT;
%CPUSUM;
The statements starting with the word %LET define the macro
variables. Later references to the macro variables &BY and
&BREAK resolve to the values you assign here. The %fffSUM
macros assume that the macro variables &BY and &BREAK are
defined by the user, and require these values to perform
summarization.
This statement defines the variable list used by the PROC
SORT and by the %fffSUM macro:
%LET BY = variable-summarization-list;
This ensures that the same list is used for sequencing and
for summarization itself.
The order of the &BY list (variable-summarization-list)
should be from major to minor. Also, the last parameter in
the &BY list must be the most-minor-summarization-variable
defined in the &BREAK macro variable.
The last item to be defined is the summary macro itself. One
unique macro is provided for each CA MICS file. The macro
name has the form %fffSUM, where fff is the file ID. The
file ID is the last three characters of the file name. For
example, for the HARCPU file, the ID is CPU.
Copyright © 2014 CA.
All rights reserved.
 
|
|