|
SUBFOOT Vs. SUBTOTAL With ACROSS
When you need to produce a subtotal within a
TABLE request, just add
ON fieldname
SUBTOTAL or
ON TABLE SUBTOTAL. However, this calculates a subtotal for all of the verb objects, which you many not necessarily want.
For example, if one of the verb objects is a
COMPUTE, we may want the computation redone. In this case, we could use
RECOMPUTE instead (or use
SUMMARIZE instead of
SUBTOTAL). But let's say you have a column that is a computed field with an alphanumeric data type (producing a flag), or you are using
ACROSS and do not want all the columns totaled.
Then what?
In this case, use
SUBFOOT instead of
SUBTOTAL to identify and position column totals selectively. However, this becomes more difficult with
ACROSS, since multiple fields have the same name and must be identified individually.
Is there a better way?
You may use
RECAP to perform calculations on sort field breaks.
RECAP uses subtotal values and accepts column notation. When a
SUBFOOT uses
RECAPS, the recapped values appear only in the
SUBFOOT. This means that you may use
RECAP to identify fields to be subtotaled and, in effect, give them unique names. Thus, we might use a combination of
RECAP with
SUBFOOT.
For example:
TABLE FILE CAR
SUM SEATS BY COUNTRY ACROSS BODYTYPE
ON TABLE RECAP
S1/I3=C1;
S2/I3=C2;
ON TABLE SUBFOOT
"TOTAL* <12 <25"
END |
This produces a
SUBFOOT for only the first two columns (C1 and C2). In addition to printing subtotals, you may use
RECAP to perform other types of calculations. It is up to you to take full advantage of this flexibility.
|