Q4. Are you … Living with your parents/guardian 1 SCREENOUT Living alone 2 GO TO Q6 Living with partner only 3 GO TO Q6 Living with children only 4 Living with partner and children 5 Sharing accommodation 6 GO TO Q6 Other (Please type into the box.) 7 GO TO Q6 Q5. How many children live with you in the following age groups? Please make sure you type a number into every box a) __ Under 5 b) __ 5-7 c) __ 8-11 d) __ 12-14 e) __ 15-17 f) __ 18 to 24 g) __ 25 or over
The Expression is then:
if (Q4 == 2) 1; else if (Q4 == 3) 2; else if (Q4 == 4) 1 + Q5_A + Q5_B + Q5_C + Q5_D + Q5_E + Q5_F + Q5_G; else if (Q4 == 5) 2 + Q5_A + Q5_B + Q5_C + Q5_D + Q5_E + Q5_F + Q5_G; else if (Q4 >= 6) 3;
Note that in the case of the last category, sharing accommodation and other, a guess of family size being 3 has been made.
Banners describes a more straight-forward approach for creating a table with categories like these (but which does not create a new variable, as is shown above).