Dear All,
I have a dataset where one of the variables represents a multiple-choice question, but all responses are recorded within a single variable. What I need to do is create several dummy variables corresponding to each option in the multiple-choice question. Each dummy variable should be assigned a value of 1 if the response includes the respective option, and 0 if it does not.
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Could copy only few data since there is a limit. For example : lack of personal confidence, i have a good job/ business at hand, cannot spare time from my household chores" : convert it into thre
These are the options in my multiple choice question:
lack of personal confidence
Discouraging socio-cultural environment for women to participate
Never got opportunities from any party
I have a good job/ business at hand
Cannot spare time from my household chores
Gender biases society
Lack of education qualification
So I want in total 7 dummy variables to be created
For Example: lack of personal confidence, i have a good job/ business at hand, cannot spare time from my household chores" : this particular data point will have "1" in all three of these options and 0 in the other.
Thank you in advance.
I have a dataset where one of the variables represents a multiple-choice question, but all responses are recorded within a single variable. What I need to do is create several dummy variables corresponding to each option in the multiple-choice question. Each dummy variable should be assigned a value of 1 if the response includes the respective option, and 0 if it does not.
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str270 N "lack of education qualification" "lack of education qualification" "lack of personal confidence, i have a good job/ business at hand, cannot spare time from my household chores" "lack of education qualification" "lack of personal confidence, lack of education qualification" "lack of education qualification" "lack of personal confidence" "never got opportunities from any party" "lack of personal confidence" "never got opportunities from any party" "lack of personal confidence" "never got opportunities from any party" "never got opportunities from any party" "i have a good job/ business at hand" "i have a good job/ business at hand" "i have a good job/ business at hand" "discouraging socio-cultural environment for women to participate, i have a good job/ business at hand" "never got opportunities from any party, gender biases society" "never got opportunities from any party, i have a good job/ business at hand" "lack of personal confidence" "i have a good job/ business at hand" "i have a good job/ business at hand" "" "" end
Could copy only few data since there is a limit. For example : lack of personal confidence, i have a good job/ business at hand, cannot spare time from my household chores" : convert it into thre
These are the options in my multiple choice question:
lack of personal confidence
Discouraging socio-cultural environment for women to participate
Never got opportunities from any party
I have a good job/ business at hand
Cannot spare time from my household chores
Gender biases society
Lack of education qualification
So I want in total 7 dummy variables to be created
For Example: lack of personal confidence, i have a good job/ business at hand, cannot spare time from my household chores" : this particular data point will have "1" in all three of these options and 0 in the other.
Thank you in advance.
Comment