

Common Techniques Used In Reporting › 5.5 Using Summarization › 5.5.4 Augmenting the Summarization with %NEGATE
5.5.4 Augmenting the Summarization with %NEGATE
Sometimes you may want to augment the processing that occurs
in a summary macro before a summarized observation is written
to the output file. In other words, you want some action to
be taken on each summarized observation.
For example, you may want to calculate a new variable (a new
data element) that you want added to the output file. Or you
may want to write a second output file that contains only a
subset of all the summarized observations. To facilitate
this, every summary macro invokes a macro named NEGATE (New
Element GATE) at the end of its processing and immediately
before its OUTPUT statement.
To make use of the NEGATE macro, you must define within it
the processing you want to occur before the OUTPUT statement
is executed. Note that this must be done before executing
the summary macro that is to invoke it.
A typical setting for the NEGATE macro looks like this:
%MACRO NEGATE;
IF JOBSYSAB GT 0 OR JOBUSRAB GT 0 THEN DIDABEND EQ 1;
%MEND NEGATE;
DATA WORK.TECHFILE;
SET %MFILE(DATABASE=P,TIMESPAN=DAYS,FILE=JOB01-31);
%JOBSUM(OUT=TECHFILE);
RUN;
%MACRO NEGATE; %MEND NEGATE;
Important! Be sure that %NEGATE content affects only the
intended summary macro and not every macro in your program.
This is accomplished by "emptying" the NEGATE macro. To do
this, specify this in your program immediately after the
execution of the summary macro that used your NEGATE macro:
%MACRO NEGATE; %MEND NEGATE;
Copyright © 2014 CA.
All rights reserved.
 
|
|