Hi, I have a problem to create cross table for survey data contained "select all that applied" questions. The data is like below (Headache and Insomnia are two options in one "select all that applied" questions, so they may overlapped): ID Treatment Headache Insomnia 1 1 0 0 2 0 1 0 3 1 1 0 4 1 1 0 5 1 1 0 6 0 0 0 7 1 1 1 8 1 1 0 9 0 1 0 10 1 1 0 11 1 1 1 12 1 1 0 13 0 1 0 14 0 0 0 15 1 0 0 16 1 1 0 17 1 0 1 18 1 1 0 19 1 1 0 20 1 1 0 The usual cross table is var by Headache or var by Insomnia separately with (0,1)x(0,1). But I wonder how I can get a cross table crossing all options = 1 together, like the following table: Treatment Headache=1 [N (%)] Insomnia=1 [N (%)] 1 xx (a%) xx (b%) 0 xx (c%) xx (d%) Total n_1 (100%) n_2 (100%) In this case, only a+c=100% make sense. For the completeness, I also wonder how to get a "transposed" table like: Treatment 1 [N (%)] 0 [N (%)] Total Headache=1 xx (a%) xx (b%) n_1 (100%) Insomnia=1 xx (c%) xx (d%) n_2 (100%) In this case, of course only a+b=100% make sense. Hope someone could help. Thanks so much!
... View more