stace swayne wrote:
Dear list,
I have to create sub-samples from a larger data set and I have a few questions:
Here is the back ground:
I have a data set with 252 people, I have been asked to create sub-samples from this data set based on the following conditions and combine them together to reflect anyone in the sample who reported having an accident :
(1) Any individual who answered YES to the first accident inquiry (question #1)
(2) Anyone who answered NO to question 1 but YES to question 6 (another accident inquiry question)
(3) Anyone who answered NO to question 1&6, but answered YES to question 15 (another accident inquiry question)
(4) Anyone who answered no to questions 1,6,&15 but answered YES to question 28.
My question is: how would I go about writing the syntax to select based on these conditions.
All suggestions are appreciated,
Thanks,
Stace
If Yes and No are the only possible responses, and if they are coded Y=1, N=0, then this should work:
compute accident = Q1 or
(~Q1 and Q6) or
(~Q1 and ~Q6 and Q15) or
(~Q1 and ~Q6 and ~Q15 and Q28) . /* ~ means "not" .
exe.
filter by accident.
If you used codes Y=1 N=2, then you you need to be a bit more explicit, like this:
compute accident = (Q1 EQ 1) OR
((Q1 EQ 2) and (Q6 EQ 1)) OR
((Q1 EQ 2) and (Q6 EQ 2) and (Q15 EQ 1)) OR
((Q1 EQ 2) and (Q6 EQ 2) and (Q15 EQ 2) and (Q28 EQ 1)) .
exe.
filter by accident.
Personally, though, I always try to use the 1=Y 0=N codes, or recode to that if given data from someone else, because the coding is much neater.