Hello,
I have responses from a questionnaire, where several questions have "select all that apply." These questions have been entered into STATA as a single string variable, separated by commas.
Is there a way to generate new columns for each unique response in the cell, and have the values appear in their specific newly generated columns?
For example, we have a list of activities numbered 1-11. A single cell may contain any combination of these numbers, such as (1,2,5,7,9).
We tried the following command: "split activities, parse(,) gen(activity)" and it produces columns titled Activity1 through Activity 11, but all numbers in the columns in order (ie. 1 will be in activity1, 2 will be in activity2, but then 5 will appear in activity3 etc. rather than under activity5).
Is there a way to do this? Thanks in advance for any advice.
I have responses from a questionnaire, where several questions have "select all that apply." These questions have been entered into STATA as a single string variable, separated by commas.
Is there a way to generate new columns for each unique response in the cell, and have the values appear in their specific newly generated columns?
For example, we have a list of activities numbered 1-11. A single cell may contain any combination of these numbers, such as (1,2,5,7,9).
We tried the following command: "split activities, parse(,) gen(activity)" and it produces columns titled Activity1 through Activity 11, but all numbers in the columns in order (ie. 1 will be in activity1, 2 will be in activity2, but then 5 will appear in activity3 etc. rather than under activity5).
Is there a way to do this? Thanks in advance for any advice.
Comment