I have data from a survey. It comes from a question that looks like this:
Did you do any of the following activities during your PhD
Yes, paid by my school. Yes, paid by me. No.
Attended an internationl conference?
Bought textbooks?
The data is automatically saved in a spreadsheet in this way:
id conf.1 conf.2 conf.3 text.1 text.2 text.3
1 1 1
2 1 1
3 1 1
4 1 1
5
This means participant 1 attended a conference paid by her university; particiapnt 2 attended the conference paid by him, and participant 3 didn’t go.
I want to merge conf.1, conf.2 and conf.3 and text.1, text.2 and text.3 in single variables
id new.conf new.text
1 1 2
2 2 1
3 3 1
4 3 3
where the number now respresents the categories of the survey question
Thanks for your help
You don’t state whether or not each set of questions can have multiple answers. If so, this approach may not work for you. If that’s the case, I suggest making your question more reproducible before moving forward. With that caveat out of the way, give this a whirl: