I already asked a question about conditional counting of cases (https://forum.openoffice.org/en/forum/v ... 5&p=420316), but I now realize that I need to ask another.

Suppose I have 4 columns: RACE, NATIONALITY, MAJOR and WEIGHT and each row is a student. RACE can take any value in {1,2,3}, NATIONALITY any value in {1,2,3,4,5,6,7}, MAJOR any value in {1,2,3,4,5,6,7,8,9,10} and WEIGHT is a numerical value used to weigh each person in the sample so that the results would reflect the population.

How do I, for example, count the number of rows that have RACE = 1 and (NATIONALITY = 3 or MAJOR = 5) but such that each row that satisfies this condition is counted not as 1 but as the value of WEIGHT? (See my previous question linked to above if what I mean here isn't clear.) I guess I could count the number of rows that have RACE = 1 and NATIONALITY = 3, add the number of rows that have RACE = 1 and MAJOR = 5 and subtract the number of rows that have RACE = 1 and (NATIONALITY = 3 and MAJOR = 5), but that's a pain and I'm sure there is an easier way to do that. (It's even more of a pain because some respondents in the sample may have answered the question for NATIONALITY but not MAJOR or vice versa and, since ultimately my goal is to calculate the proportion of respondents who have RACE = 1 and (NATIONALITY = 3 or MAJOR = 5) among those who have answered the questions for RACE, NATIONALITY and MAJOR, while ignoring the respondents who didn't answer all 3 questions, so I have to deal with non-response.)

In my previous question, I only needed the rows I wanted to count to satisfy a conjunction, but here there is also a disjunction in there. (Of course, as I have noted above, I know that any expression that contains a disjunction can be expressed by one that only contains conjunction and negation, but it would be a huge pain and I'm sure there is an easier way to do what I want to do.)

I hope my question isn't too confused and would really appreciate some help!

Best,

Philippe