Question

Let's say you have a survey dataset, with 12 variables that stem from the same question, and each variable reports a response option for that question (multiple-response options possible for this question). Each variable (i.e. response option) is numeric with yes/no options. I am trying to combine all of these variables into one, so that I can do cross-tabs with other variables such as village name, and draw out the frequencies of each individual response and graphs nicely without extensive formatting. Does anyone have a solution to this: either to combine the variables or to do a multivariable cross-tab that doesn't require a lot of time spent on formatting?

Example data:

  A B C D E F
  1. 1 0 1 0 1 0
  2. 0 0 1 0 1 1
  3. 1 1 1 0 0 0
Was it helpful?

Solution

There are many tricks and techniques here.

Tricks include using egen's concat() function as well as the group() function mentioned by @Dimitriy V. Masterov.

Techniques include special tabulation or listing commands, including tabm and groups on SSC and mrtab at the Stata Journal; on the last, see this article.

See also this article in the Stata Journal for a general discussion of handling multiple responses.

OTHER TIPS

Does egen pattern = group(A-F), label do what you desire? If not, perhaps you can clarify what the desired transformation would look like for the 3 respondents you have shown.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top