How to: |
When a virtual field or calculated value can have missing values, you can specify whether all or some of the field values used in the expression that creates the DEFINE or COMPUTE field must be missing to make the result field missing. If you do not specify ALL or SOME for a DEFINE or COMPUTE with MISSING ON, the default value is SOME.
The SET parameter MISS_ON enables you to specify whether SOME or ALL should be used for MISSING ON in a DEFINE or COMPUTE that does not specify which to use.
SET MISS_ON = {SOME|ALL}
where:
Indicates that if at least one field in the expression has a value, the temporary field has a value (the missing values of the field are evaluated as 0 or blank in the calculation). If all of the fields in the expression are missing values, the temporary field has a missing value. SOME is the default value.
Indicates that if all the fields in the expression have values, the temporary field has a value. If at least one field in the expression has a missing value, the temporary field has a missing value.
The following request creates three virtual fields that all have MISSING ON. Field AAA has all missing values. Field BBB is missing only when the category is Gifts and has the value 100 otherwise. Field CCC is the sum of AAA and BBB.
SET MISS_ON = SOME DEFINE FILE GGSALES AAA/D20 MISSING ON = MISSING; BBB/D20 MISSING ON = IF CATEGORY EQ 'Gifts' THEN MISSING ELSE 100; CCC/D20 MISSING ON = AAA + BBB; END TABLE FILE GGSALES SUM AAA BBB CCC BY CATEGORY ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ END
Running the request with SET MISS_ON=SOME (the default) shows that CCC has a value unless both AAA and BBB are missing.
Changing SET MISS_ON to ALL, produces the following output. CCC is assigned a missing value because one of the fields used to calculate it is always missing.
WebFOCUS | |
Feedback |