The net result is just the way @Quentin described it. However, you may see documentation that says that %else is only executed under two conditions:
The previous %if condition was evaluated, and
The previous %if condition was found to be false.
This is also correct! How can that also be true?
Consider applying those conditions to Quentin's example. On the second line, looking at &B, clearly the logic to execute that line depends on:
SAS examined &A from the previous %if condition, and
SAS found that &A was false.
When both of those bullet points are true, the software executes %if &B %then ....;
When &A was true, the software skips evaluating %if &B %then ....;
So what happens when we get to &C? The software checks:
Did we evaluate the previous %if condiition for &B?
Was it false?
So when &B was false, the software skips evaluating &C, and never executes %if &C %then ....;
In essence, with a set of %else statements, each one always means was the previous %if condiition evaluated and found to be true. However, the result is the one you hope for: %else requires all the previous %if conditions to be true. The logic behind that, however, is that once a true condition is found, the next %else statement is skipped. Once one is skipped, all the rest are skipped.
... View more