Chapter Contents Previous Next
 Language Reference

## ALL Function

checks for all elements nonzero

ALL( matrix)

where matrix is a numeric matrix or literal.

The ALL function returns a value of 1 if all elements in matrix are nonzero. If any element of matrix is zero, the ALL function returns a value of 0. Missing values in matrix are treated as zeros.

You can use the ALL function to express the results of a comparison operator as a single 1 or 0. For example, the comparison operation A>B yields a matrix containing elements that can be either ones or zeros. All the elements of the new matrix are ones only if each element of A is greater than the corresponding element of B.

For example, consider the statement

```   if all(a>b) then goto loop;
```
IML executes the GOTO statement only if every element of A is greater than the corresponding element of B. The ALL function is implicitly applied to the evaluation of all conditional expressions. The statements
```   if (a>b) then goto loop;
```
and
```   if all(a>b) then goto loop;
```
have the same effect.

 Chapter Contents Previous Next Top