IBM 15 Switch User Manual


 
115
Building CLEM Expressions
Calculating Time Passed
You can easily calculate the time passed from a baseline date using a fam ily of functions sim ilar to
the following one. This function returns the time in months from the baseline date to the date
represented by the date string DATE as a real number. This is an approximate gure , based on a
month of 30.0 days.
date_in_months(Date)
Comparing Date/Time Values
Value s of date/ti me elds can be compared across records using function s similar to the followi ng
one. This function returns a value of true if the date string DATE1 represent s a date prior to that
represented by the date stri ng DATE2. Oth erwise, this function returns a value of 0.
date_before(Date1, Date2)
Calculating Differences
You can also calculate the difference between two times and two dates using functions, su ch as:
date_weeks_difference(Date1, Date2)
This function returns the time in weeks from t he date represented by the d ate string DATE1 to the
date represen ted by the date strin g DATE2 as a real numbe r. This is based on a week of 7.0 days. If
DATE2 is prior to DATE1, this function returns a negati
ve numb er.
Today’s Date
The current date can b e added to the data set using the function @TODAY. Today’s date is added as
a string to the specied eld or new eld us ing the date format selected in the stream properties
dialog box. For m ore information, see the topic Date and Time Functions in Chapter 8 on p. 146.
Summarizing Multiple Fields
The CLEM l an guage includes a number of functions that return summary statistics across
multiple elds. These functions may be particularly useful in analyzing survey data, where
multiple responses to a question may be stored in multiple elds. For more information, see the
topic Working with Multiple-Resp onse Data on p. 117.
Comparison Functions
You can compare values across multiple elds using the min_n and max_n functions—for example:
max_n(['card1fee' 'card2fee''card3fee''card4fee'])