sasoperator-keyword

Why doesn't SAS support short circuit operator?


Run the code in SAS
data _null_; if 1 or sum(.) then put 'Hi!'; run;
It reports missing value was generated which shows 'or' is not a short circuit operator.
Why doesn't SAS support short circuit operation?


Solution

  • The strongest argument is for continued proper operation of all legacy SAS code, that knowingly or unknowingly rely on it.

    As for the original why, that would be a question for the originators. https://en.wikipedia.org/wiki/SAS_(software)#Origins

    There may be un-documented options for causing the DATA Step compiler to generate 'optimized' code that might include shortcut evaluations.