You can also compute a new value based on subtotals using RECAP.
The format of the RECAP command is:
{ON|BY} fieldname1 RECAP fieldname2[/format]=calculation;
In the above structure, fieldname1 must be a BY field. Each time the BY field changes in the report, recapped information appears. RECAP indicates that a new field is going to be created for subtotal purposes. Fieldname2 is the new field and equals the calculation you provide. The /format is optional, but if you use it, it must be numeric. You use this to change the default format of D12.2 to indicate the new field format.
For example, you could calculate the percentage of salary deductions applied to gross salary for each department, using RECAP.
Issue the following request:
TABLE FILE EMPLOYEE SUM DED_AMT GROSS BY DEPARTMENT BY HIGHEST PAY_DATE ON DEPARTMENT RECAP DED_PCT/D6.2=(DED_AMT/GROSS)*100; END
Run the request. The output is:
Notice that for each department a new field and its calculated value appears. Using RECAP enables you to produce subtotals based on a calculation you provide.
WebFOCUS | |
Feedback |