About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Feb 11, 2025
The CLEM language includes a number of functions that return summary statistics across multiple fields.
These functions may be particularly useful in analyzing survey data, where multiple responses to a question may be stored in multiple fields. See Working with multiple-response data for more information.
Comparison functions
You can compare values across multiple fields using the
and min_n
functions. For example: max_n
max_n(['card1fee' 'card2fee''card3fee''card4fee'])
You can also use a number of counting functions to obtain counts of values that meet specific criteria, even when those values are stored in multiple fields. For example, to count the number of cards that have been held for more than five years:
count_greater_than(5, ['cardtenure' 'card2tenure' 'card3tenure'])
To count null values across the same set of fields:
count_nulls(['cardtenure' 'card2tenure' 'card3tenure'])
Note that this example counts the number of cards being held, not the number of people holding them. See Comparison functions for more information.
To count the number of times a specified value occurs across multiple fields,
you can use the
function. The following example counts the number of
fields in the list that contain the value count_equal
.Y
count_equal("Y",[Answer1, Answer2, Answer3])
Given the following values for the fields in the list, the function returns
the results for the value
as shown.Y
Answer1 | Answer2 | Answer3 | Count |
---|---|---|---|
Y | N | Y | 2 |
Y | N | N | 1 |
Numeric functions
You can obtain statistics across multiple fields using the
, sum_n
, and mean_n
function. For example: sdev_n
sum_n(['card1bal' 'card2bal''card3bal'])
mean_n(['card1bal' 'card2bal''card3bal'])
See Numeric functions for more information.
Generating lists of fields
When using any of the functions that accept a list of fields as input, the
special functions
and
@FIELDS_BETWEEN(start, end)
can be used as input. For example, assuming the order of
fields is as shown in the @FIELDS_MATCHING(pattern)
example earlier, the following would be
equivalent:sum_n
sum_n(@FIELDS_BETWEEN(card1bal, card3bal))
Alternatively, to count the number of null values across all fields beginning with "card":
count_nulls(@FIELDS_MATCHING('card*'))
See Special fields for more information.
Was the topic helpful?
0/1000