x = 5+2*4;(is ambiguous.)Do you mean: (5+2)*4;Ordo you mean: 5+(2*4);
What about: A or B and C;
A SAS expression with no more than one operator is called a simple expression. When an expression includes several operators, it is called a compound expression. When SAS encounters a compound expression, it follows certain rules to determine the order in which to evaluate each part of the expression. Knowing about this operator order, and how to use parentheses to alter it, can be crucial when writing compound expressions.
In the code to the right operator order determines whether X takes on the value of 13 or 28. These two IF statements are not equivalent and operator order and evaluation dictates the application of the logic. You are well advised to use parentheses.