MICS Summarization Macros

Document ID : KB000055605
Last Modified Date : 14/02/2018
Show Technical Document Details

ABSTRACT:

How to invoke and use MICS summarization macros in user reports to ensure the correct data values will be generated

Technique 1 - Overriding the Length of MICS Data Elements

Two macros are used to define the characteristics of each file specific and common element in a MICS data base file. These macros are based on the time span of the file and are specified between the DATA and SET statements in SAS code.

These macros are:

%JOBLEN(ts=t)  
%JOBFMT(ts=t) 
* t=(DETAIL, DAYS, WEEKS, MONTHS, YEARS, APPL)  
  (APPL is used to specify the sharedprefix.tables) 

The length specifications in these macros are used as the input and output defaults during SAS processing and allow MICS to store data elements in the least amount of DASD space. They can be used, in conjunction with the MICS summarization macros, to summarize all element types (i.e., retained, minimum, maximum, accumulated and computed elements). We recommend that you use these macros instead of SAS PROC MEANS or PROC SUMMARY procedures when creating reports, because they derive summarized data elements with greater accuracy. Make sure, however, that you choose the correct macro when summarizing MICS data.

For example, suppose that you wanted to produce a report on the total number of jobs that executed yesterday, and summarize the JOBCOUNT element in the DETAIL level of the BATJOB file. The %JOBLEN and %JOBFMT macros are used to create this file. Since JOBCOUNT can only equal one in this time span, it has a SAS length of two bytes. This length allows for the summarization of up to 255 jobs. If JOBCOUNT is summarized for even one cycle, the field could overflow. The length of JOBCOUNT, for the days timespan, in the %JOBLEN macro is three bytes. This length allows for the summarization of up to 255 jobs. That is why we recommend that you override the field length when summarizing MICS elements in the DETAIL time span.

Tips and Hints (Continued)

Let's look at another example. If you wanted to summarize six cycles of the BATJOB file by ACCTNO1, the following length and summarization macros could be used to produce the report.

//MICS EXEC MICSSHRP
//SYSIN DD DATA,DLM=zz
%LET BY=ACCTNO1;
%LET BREAK=ACCTNO1;
 
DATA JOB;
%JOBLEN(TS=days)
%JOBFMT(TS=days)
SET &PBATX..BATJOB06 &PBATX..BATJOB05 &PBATX..BATJOB04
    &PBATX..BATJOB03 &PBATX..BATJOB02 &PBATX..BATJOB01;
PROC SORT; BY &BY;
DATA JOB; SET JOB; %JOBSUM; PROC PRINT; BY &BY; ID &BY; VAR JOBCOUNT JOBCPUTM; SUM JOBCOUNT JOBCPUTM;

Technique 2 - Using MICS-Generated Sequence Macros

The second technique involves the use of MICS sequence macros. Sequence macros simply list MICS sort elements in the order that they were defined. MICS generates these macros for every MICS file and time span in the form:

 %fffSEQ(TS=t)

where "fff" equals the file ID, and "t" equals the time span. The "t" equals: DETAIL or DAYS or WEEKS or YEARS or APPL. In this format invocation of the %fffSEQ(OP=BREAK,TS=t) macro, will define the last element in the sort sequence for that file and time span.

In the following example, the user wants to select the jobs that are taking over 20 seconds of CPU time from multiple cycles of the BATJOB file and then summarize to the days timespan. The following code will accomplish this.

Tips and Hints (Continued)

     //MICS   EXEC MICSSHRP
     //SYSIN  DD DATA,DLM=zz
     %LET &BY=JOBSEQ(TS=days);
     %LET &BREAK=JOBSEQ(OP=BREAK,TS=days);
DATA JOB; %JOBLEN(TS=days) %JOBFMT(TS=days) SET &PBATX..BATJOB06 &PBATX..BATJOB05 &PBATX..BATJOB04 &PBATX..BATJOB03 &PBATX..BATJOB02 &PBATX..BATJOB01; IF JOBCPUTM > 20;
PROC SORT; BY &BY; DATA JOB; SET JOB; %JOBSUM;

References: MICS Retrieval and Reporting Guide, section 2.5.3, Using the MICS Summarization Facility.