On Wed, 17 Dec 2003, Richard Williams wrote:
> In SPSS, I could do something like
>
> DO IF X1 = 1 and X2 = 3
> Compute Y = 3.
> ELSE IF X3 = 2 and X4 = 17
> Compute Y = 4.
> ELSE
> Compute Y = 5.
> END IF.
Although Richard's point--that most programming languages contain an if-then-else structure--this example shows one of the potential confusions of that structure. What if (x1/x4) = (1,3,2,17) ? In this example, that will yield y=4; the order of the if-else clauses matters. Perhaps this is not very likely to be a realistic application of if-then-else--more likely that the conditions are mutually exclusive--but whether one programs this as if-then-else or, as in Stata, as successive 'replace if' statements, the ordering of these evaluations matters.