user manual

115
Building CLEM Expressions
Calculating Time Passed
You can easily calculate the time passed from a baselin e date using a family of functions similar 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 approxima te gure, based on a
month of 30.0 days.
date_in_months(Date)
Comparing Date/Time Values
Value s of da te/time elds can be compared across records using functions similar to the following
one. This function returns a value of true if the date string DATE1 represents a date prior to that
represented by the date string DATE2. Otherwise, this function returns a val ue of 0.
date_before(Date1, Date2)
Calculating Differences
You can a ls o c alculate the differen ce between two times and two dates u sing functions, such as:
date_weeks_difference(Date1, Date2)
This function returns the time in weeks from the date represented by the date strin g DATE1 to the
date re presented by the date string DATE2 as a real number. This is based on a week of 7.0 days. If
DATE2 is prior to DATE1, this fu nction returns a negati
ve number.
Today’s Date
The current date can be added to the data set using the function @TODAY. Today’s date is added as
a string to the specied eld o r new eld u sing the date forma t selected in the stream properties
dialog box. For more information, see the topic Date and Time Fun ctions in Chapte r 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 re spons es to a question may be store d in multiple elds. For more information, see the
topic Working with M ultiple-R esponse Data on p. 117.
Comparison Functions
You can compare values across multipl e elds using t he min_n and max_n functions—for example:
max_n(['card1fee' 'card2fee''card3fee''card4fee'])