Scripting > Expressions > Operators > Categorical comparison operators
 
Categorical comparison operators
This topic provides a summary of how comparison operators work with categorical variables. Some of the examples show using the operators with category names and some with the numeric category values.
Equal to
The equal to (=) operator returns True if the two variables have the same categories irrespective of order.
Examples
Result
{1,3,6,8} = {3,1,6,8}
True
{1,3,6,8} = {3,1,6}
False
{FOSSILS, BIRDS, WHALES} = {WHALES, BIRDS, FOSSILS}
True
{FOSSILS, BIRDS, WHALES} = {BIRDS, FOSSILS}
False
Not equal to
The not equal to (<>) operator returns True if the two variables contain different categories.
Examples
Result
{1,3,6,8} <> {3,1,6,8}
False
{1,3,6,8} <> {3,1,6}
True
{FOSSILS, BIRDS, WHALES} <> {WHALES, BIRDS, FOSSILS}
False
{FOSSILS, BIRDS, WHALES} <> {BIRDS, FOSSILS}
True
Less than and less than or equal to
The less than (<) operator returns True if the list of categories on the left side is a proper subset of the list of categories on the right side. The less than or equal to (<=) operator returns True if the list of categories on the left is a subset of, or equal to, the one on the right.
Examples
Result
{1,3,6} < {1,3,6,8}
True
{1,3,6} < {1,3,8,9}
False
{1,3,6} < {1,3,6}
False
{1,3,6} <= {1,3,6}
True
{FOSSILS, BIRDS, WHALES} < {WHALES, BIRDS, FOSSILS}
False
{FOSSILS, BIRDS, WHALES} <= {WHALES, BIRDS, FOSSILS}
True
{BIRDS, FOSSILS} < {FOSSILS, BIRDS, WHALES}
True
Greater than and greater than or equal to
The greater than (>) operator returns True if the list of categories on the left side is a proper superset of the list of categories on the right side. The greater than or equal to (>=) operator returns True if the list of categories on the left is a superset of, or is equal to, the one on the right.
Examples
Result
{1,3,6,8} > {1,3,6}
True
{1,3,8,9} > {1,3,6}
False
{1,3,6} > {1,3,6}
False
{1,3,6} >= {1,3,6}
True
{FOSSILS, BIRDS, WHALES} > {WHALES, BIRDS, FOSSILS}
False
{FOSSILS, BIRDS, WHALES} >= {WHALES, BIRDS, FOSSILS}
True
{WHALES, BIRDS, FOSSILS} > {FOSSILS, BIRDS}
True
Has intersection
The has intersection (=*) operator returns true if the intersection of the two values is not empty.
Examples
Result
{1,4,5} =* {3,1,6,8}
True
{3, 8} =* {1,6}
False
{FOSSILS, BIRDS } =* {WHALES, FOSSILS}
True
{ WHALES} =* {BIRDS, FOSSILS}
False
See
Operators