apeape wrote:This can definitely get confusing especially if you aren't used to boolean logic. The statement of your original query is known as a 'joint denial' or 'logical nor' - or to put it more simply that X is true only when *both* A and B are false.

Read up on Truth Functions (

https://en.wikipedia.org/wiki/Truth_function).

Perhaps you'll get a better understanding if we simulate the logical gates in SPSS with the following code and look at the resultant truth tables:

Code: Select all

```
data list list / P Q (2a1).
begin data.
T F
T T
F F
F T
end data.
compute conjunction = (P = 'T' and Q = 'T').
compute disjunction = (P = 'T' or Q = 'T').
compute jointdenial = (P <> 'T' and Q <> 'T').
compute altdenial = (P <> 'T' or Q <> 'T').
exe.
```

First, I want to thank you for your responses. I appreciate the help!

I am in fact familiar with boolean logic, I've been using statistics and programming for decades. But I am always open to learning something new.

What I am using in my code is what you have defined as the joint denial, as you mentioned. I ran your code, and the only case where the joint denial was true (1) was the third case, where both P and Q are false. When I used a select if (P <> "T" and Q <> "T"), it correctly retained only that one case.

Applying that to my original example, the only cases that should have been kept were those where *both* conditions, vara <> N and varb <> M, are true, analogous to both P and Q being F. But it was de-selecting those cases where varb <> M regardless of the value of vara.

By the way, it seems that the If statement (without select) does this the way I would expect.