I have survey data where, for some questions, respondents were able to choose multiple options. I received that data where those different responses are all in the same column, separated by commas, as you can see in the data below.
I am hoping to produce tables with a count of the number of times each option (a, b, c, etc.) was chosen. So in my example data below, for q01, "a" would be 3, "c" would be 3, etc. I was originally thinking I may have to split the variables into separate columns and do some work by hand to combine them on the back end, but if anyone has a more efficient idea, please let me know!
Here is a small subset of the data (the full data set has a couple hundred respondents and about 20 questions. Thanks much.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id str4(q01 q02) str7 q03 100 "a, c" "b" "a, b, e" 101 "d, c" "b" "a, e" 102 "c" "b, c" "b, c, e" 103 "d, f" "b" "b, c" 104 "a, f" "b, c" "b" 105 "a, f" "b" "c" 106 "f" "b" "a, b" end
0 Response to Tabs for data with commas
Post a Comment