Hello, I have cleaned a survey which I now need to do some analysis, for the most part this has been straightforward except for a few questions that are the same format and which have confounded me so far.
The type of question is one in which it has multiple sub-questions, in which respondents say "yes" or "no" or "don't know" for each subquestion, or select something from a Likert-type scale. However, I am hoping to calculate the frequency of all subquestions all in the same table per question. For those that are "yes/no", that would just be the percentage of those who say "yes", or would be the percentage who chose each Likert-item 1 through 4, for example. You can see in my data example that q15 and q21 are yes/no, and q24 is one with a likert scale.
I have tried various attempts with generating new vars, then using -tab-, -tabstat-, or -fre-, and also attempted with -collapse- with no success.
So with this, I would hope for it (output table) to look something like (with a separate table for each question, obviously):
The type of question is one in which it has multiple sub-questions, in which respondents say "yes" or "no" or "don't know" for each subquestion, or select something from a Likert-type scale. However, I am hoping to calculate the frequency of all subquestions all in the same table per question. For those that are "yes/no", that would just be the percentage of those who say "yes", or would be the percentage who chose each Likert-item 1 through 4, for example. You can see in my data example that q15 and q21 are yes/no, and q24 is one with a likert scale.
I have tried various attempts with generating new vars, then using -tab-, -tabstat-, or -fre-, and also attempted with -collapse- with no success.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(q15a q15b q15c q15d q21a q21b q21c q21d q24a q24b q24c q24d) 1 1 2 1 1 1 1 1 . . . . 1 1 1 1 1 1 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 3 3 3 1 2 2 1 2 2 1 1 3 . 3 3 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 1 1 1 2 . . . . . 1 2 2 1 2 1 2 2 1 1 3 2 1 2 2 2 1 1 1 1 . . . . 1 1 1 1 1 1 1 1 . . . . 1 1 2 1 1 1 1 1 . . . . 1 1 1 1 1 1 1 1 4 . . . 1 . . 1 1 1 1 1 3 . . . 1 2 2 1 1 1 1 1 3 . . 3 1 2 2 2 1 1 1 1 . . . . 1 2 2 1 1 1 1 1 . . . 4 1 . . . 1 1 1 . 4 . 4 4 1 1 1 1 . . . . . . . . 1 1 1 1 1 1 1 1 3 . . . 1 1 1 1 1 1 1 1 3 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1 1 1 1 1 1 1 . . . 4 1 1 . 1 1 1 . 1 4 . . 4 1 . . 1 2 2 2 1 . . . 3 1 2 2 2 1 1 2 2 . 3 . 2 1 2 2 2 1 1 1 1 . . . 4 1 1 1 1 1 1 1 1 2 2 2 2 1 2 2 . 1 1 . 2 3 . 3 3 1 1 . 1 1 1 1 1 . . . . 1 2 . . 1 2 . 2 2 3 4 3 1 2 2 2 1 1 1 1 . . . . 1 2 2 2 1 1 1 1 2 . . 3 1 . 1 1 1 2 1 1 3 . . 3 1 2 2 1 1 1 1 1 3 . . 3 1 1 . 1 1 2 1 2 3 3 3 3 1 2 2 2 1 1 1 1 . 1 4 1 1 1 1 1 1 1 1 1 2 . . 4 1 2 2 1 1 2 1 1 3 . 3 . 1 1 2 1 2 2 1 1 2 2 2 . 1 1 2 1 2 2 1 1 3 3 1 1 1 1 . 1 1 1 1 1 2 . . 2 1 1 1 1 2 1 2 1 1 1 3 2 1 . 2 1 1 1 1 1 2 . . 3 1 2 2 1 1 2 2 1 . . 3 . 1 1 2 1 1 1 1 1 3 . . 4 1 2 2 1 1 1 1 1 2 . . 4 1 . . 1 1 1 1 1 . . . . 1 1 2 1 1 1 1 1 3 . . 4 1 1 2 2 1 1 1 1 . . . . 1 2 2 2 1 2 1 1 2 . . . 1 1 1 1 1 1 1 1 3 2 2 3 1 2 2 . 2 2 1 1 3 . . . 1 2 2 1 1 1 1 1 3 . 4 3 1 2 2 1 1 1 1 1 3 . . 3 1 1 2 1 1 1 1 2 2 2 2 3 1 1 1 1 1 1 1 . 3 . 4 . 1 2 2 1 2 1 1 2 2 3 3 2 end
So with this, I would hope for it (output table) to look something like (with a separate table for each question, obviously):
q15a | x% |
q15b | x% |
q15c | x% |
Comment