Previous
Previous
 
Next
Next

Comparing NA Values in Boolean Expressions

When the data you are comparing in a Boolean expression involves an NA value, a YES or NO result is returned when that makes sense. For example, when you test whether an NA value equals a non-NA value, then the result is NO. However, when the result would be misleading, then NA is returned. For example, testing whether an NA value is less than or greater than a non–NA value gives a result of NA.

Table: Boolean Expressions with NA Values that Result in non-NA Values shows the results of Boolean expressions involving NA values, which yield non-NA values.

Boolean Expressions with NA Values that Result in non-NA Values

Expressions Result

NA EQ NA

YES

NA NE NA

NO

NA EQ non-NA

NO

NA NE non-NA

YES

NA AND NO

NO

NA OR YES

YES