If/Else/Then statement in Bex
I want to create some conditional logic in Bex formula. The logic I need is:
IF (KeyFigA exists) THEN (use KeyFigA) ELSE IF (KeyFigB exists) THEN (use KeyFigB) ELSE (use KeyFigC)
I am a bit confused on the operators I need to use...Can anyone help?
Bob Loyd replied
It depends on what you mean by "EXISTS" here. If it means that the value is <> 0, then the logic would be:
( KFA .NE. 0 ) * KFA + (KFA == 0 ) * (KFB .NE. 0 ) * KFB + ( KFA == 0 ) * ( KFB == 0 ) * KFC
Note: ".NE." above will actually be a < followed by >, but this silly editor doesn't like those characters.
Hope this helps...