Use comparison operators to test logical conditions. They are most commonly used within the ﬁrst argument of the
IF function in order to generate a
The following are the operators you can use in Data Prep:
|Operator||Deﬁnition||Example that return true|
|=||Equal to||1 + 2 = 3|
|>||Greater than||3 > 2|
|>=||Greater than or equal to||11 >= 10
11 >= 11
|<||Less than||2 < 3|
|<=||Less than or equal to||10 <= 11
10 <= 10
|<>||Not equal to||2 <> 3|
Comparison operators with numeric values¶
Using comparison operators to conduct comparisons between numeric values is straightforward. Bear in mind, however, that the two values to be compared must both be of the same data type. The text value “3” is not the same as the numeric value 3.
To safeguard against mixing data types, use the VALUE function to convert numbers stored as text to numeric value. For example, "3" = 3 would evaluate to FALSE, but VALUE("3") = 3 would evaluate to TRUE.
Comparison operators with text values¶
The most commonly used comparison operator with text is = (equals). It is used to determine if two text strings are the same. Note that like other string functions that perform matching (such as FIND), it is case sensitive. In other words, it treats “The” as a diﬀerent string than “the”. For the comparison to be true, the two pieces of text must match exactly—including capitalization. Use of <> (not equal to) follows the same pattern as use of the = (equals). It is also case sensitive when examining text strings.
It may be surprising to note that even comparisons that include < (less than) and > (greater than)—including <= (less than or equals to) and >= (greater than or equals to)—can be used on text values. Characters are represented by a numeric value and since no two characters are the same, no two characters share the same numeric value.
Predicting the behavior of text comparisons requires some additional information about how printable characters are encoded by computers.