Cartesian Product

How to:

Reference:

Cartesian product enables you to generate a report containing all combinations of non-related records or data instances in a multi-path request. This means that if a parent segment has three child instances on one path and two child instances on another path, when CARTESIAN is ON a request that references the parent segment and both children generates 16 records. When CARTESIAN is OFF, the same request generates only three records.

For related information about controlling how selection tests are applied to child segments on independent paths, see Selecting Records for Your Report.

Syntax: How to Enable/Disable Cartesian Product

SET CARTESIAN = {OFF|ON}

where:

OFF

Disables Cartesian product. OFF is the default setting.

ON

Enables Cartesian product and generates all possible combinations of non-related records.

SET CARTESIAN may also be issued within a request.

Reference: Usage Notes for Cartesian Product

  • Cartesian product is performed on the lowest segment common to all paths, whether or not a field in that segment is referenced.
  • Short paths do not display in requests with Cartesian product.
  • The SET CARTESIAN parameter is disabled when ACROSS is specified, and a warning message is issued.
  • The SUM display command and the TOT. prefix operator have no effect on Cartesian product.
  • SUM, COMPUTE, and WITHIN in combination with the PRINT display command are performed on the Cartesian product.
  • ON TABLE COLUMN-TOTAL is automatically generated on the Cartesian product.
  • NOSPLIT is disabled if specified in combination with the SET CARTESIAN parameter, and no warning message is issued.
  • MATCH is not supported with the SET CARTESIAN parameter. A warning message is not issued if MATCH is requested, and the request is processed as if CARTESIAN is set to OFF.
  • TABLEF is not supported with the SET CARTESIAN parameter.

Example: Reporting With Cartesian Product

When CARTESIAN is set to ON, the following multi-path request produces a report containing all possible combinations of models and standards for each car:

SET CARTESIAN=ON
TABLE FILE CAR
PRINT MODEL STANDARD
BY CAR
IF CAR EQ 'JAGUAR'
END

The output in an ASCII environment is:

CAR
MODEL
STANDARD
JAGUAR
V12XKE AUTO
4 WHEEL DISC BRAKES
V12XKE AUTO
POWER STEERING
V12XKE AUTO
RECLINING BUCKET SEATS
V12XKE AUTO
WHITEWALL RADIAL PLY TIRES
V12XKE AUTO
WRAP AROUND BUMPERS
XJ12L AUTO
4 WHEEL DISC BRAKES
XJ12L AUTO
POWER STEERING
XJ12L AUTO
RECLINING BUCKET SEATS
XJ12L AUTO
WHITEWALL RADIAL PLY TIRES
XJ12L AUTO
WRAP AROUND BUMPERS

When CARTESIAN is set to OFF (the default), the same request results in a report from the CAR data source containing a list of models and standards without logical relationships.

The output in an ASCII environment is:

CAR
MODEL
STANDARD
JAGUAR
V12XKE AUTO
4 WHEEL DISC BRAKES
XJ12L AUTO
POWER STEERING
.
RECLINING BUCKET SEATS
.
WHITEWALL RADIAL PLY TIRES
.
WRAP AROUND BUMPERS