Chapter Contents |
Previous |
Next |
Language Reference |
perform elementwise logical comparisons
The AND logical operator (&) compares two matrices, element by element, to produce a new matrix. An element of the new matrix is 1 if the corresponding elements of matrix1 and matrix2 are both nonzero; otherwise, it is a zero.
An element of the new matrix produced by the OR operator (|) is 1 if either of the corresponding elements of matrix1 and matrix2 is nonzero. If both are zero, the element is zero.
The NOT prefix operator (^) examines each element of a matrix and produces a new matrix containing elements that are ones and zeros. If an element of matrix equals 0, the corresponding element in the new matrix is 1. If an element of matrix is nonzero, the corresponding element in the new matrix is 0.
The following statements illustrate the use of these logical operators:
z=x&r; if a|b then print c; if ^m then link x1;
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.