
103
Handling Missing Values
The @ functions can be used in conjunction with the @FIELD function to identify the presence
of blank or nul
l values in one or more fields. The fields can simply be flagged when blank
or null values are present, or they can be filled with replaceme nt values or used in a variety
of other operatio ns.
You can count nulls across a list of fields, as follows:
count_nulls(['cardtenure' 'card2tenure' 'card3tenure'])
When usin g any of the functions that accept a list of fields as input, the special functions
@FIELDS_BETWEEN and @FIELDS_MATCHING can be used, as sh own in the following example:
count_nulls(@FIELDS_MAT
CHING('card*'))
Figure 6-2
Using a Filler node to replace blank values with 0 in the selected field
You can use the undef functi
on to fill fields with the system-missing value, displayed as $null$.
For example, to replace any numeric value, you could use a conditional statement, such as:
if not(Age > 17) or not(Age < 66) then undef else Age endif
This replaces anything that is not in the range with a system-missing value, displayed as $null$. By
using the not() func tion, you can catch all other numeric values, including any negatives. For more
informa tion, see the topic Fun
ctions Handling Blanks and Null Values in Chapter 8 on p. 156.