Comparing data that contains missing values can return misleading results unless you specify a condition that is always true or use functions such as Is Missing() or Zero Or Missing(). Comparisons of data with mismatched types (numeric versus character) or data in matrices can also be confusing.
Some Special-Case Comparison Tests shows examples of such comparisons and matrices and explanations of the results. For a review of operators used in comparisons, see Operators. The sections that follow the table provide more details about comparison and logical operators.
m=.; m==1 |
. |
|
m=.; m!=1 |
. |
|
m=.; m<1; m>1; and so on |
. |
|
m=.; 1<m<0 |
0 |
|
{a, b}==List(a, b) |
1 |
|
{a, b}<{a, c} |
. |
|
1=="abc" |
0 |
|
1<="abc" |
. |
|
[1 2 3]==[2 2 5] |
[0 1 0] |
|
[1 2 3]==2 |
[0 1 0] |
|
[1 2 3] < [2 2 5] |
[1 0 1] |
|
[1 2 3] < 2 |
[1 0 0] |
|
Is Missing(m) |
1 |
|
Zero Or Missing(m) |
1 |
|
All([2 2]==[1 2]) |
0 |
Summarizes elementwise comparisons; returns 1 only if all comparisons are true and returns 0 otherwise.
|
Any([2 2]==[1 2]) |
1 |
Summarizes elementwise comparisons; returns 1 if any comparison is true and returns 0 otherwise.
|