As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Tips:Order of SAS Operator Evaluation
x = 5+2*4; (is ambiguous.) Do you mean: (5+2)*4; Or do 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 assignment statements are not equivalent and operator order and evaluation dictates the application of the logic. You are well advised to use parentheses when you are unsure of the logic.
Submitted by Art Carpenter. Contact me at my Discussion Page.