Reduction of multiple answers to single variable

The questionnaire for the data is here

The first question takes multiple entry for the same question, I want to reduce this to a single variable. How do I do it?

The clean data is available here. NB: The Column CompuPlat has missing values.

part of dataset

CMFam CMHobb CMNone CMOther CMPol CMProf CMRel 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 Community Membership_Family Community Membership_Hobbies Community Membership_None Community Membership_Other Community Membership_Political Community Membership_Professional Community Membership_Religious Community Membership_Support  I want to club all of them in a variable CM

• Could you paste the head of the cleaned data in the question itself? Also, what do you mean by reducing this to a single variable? If you can, please provide some more context. Examples might help too. – Nitesh Nov 18 '14 at 10:03
• Say I have put up a question to get replies for 5 disabilities, a respondent has 3 disabilities and there are multiple cases like this. How do I club all of them in a single categorical variable representing these disabilities? – Ankit Haldar Nov 18 '14 at 10:07

The variable represents the answer to the first question.

One straightforward way is to allow for all possible categories in this variable. For example, if there are 5 options in this answer, you will have to treat it as a categorical variable with 2^5 = 32 categories.

However, the number of categories increase exponentially with the number of options (check boxes) provided for the answer. In that case, it might be better to restrict the number of categories to, for example, 5. This can be done by leaving the top 4 choices/ options (by count) as they are and treating every other choice as "other".

• The issue becomes bigger when I have 11 such variables – Ankit Haldar Nov 18 '14 at 10:21
• Agreed. It becomes more and more complicated as the number of choices/ options increase. But you choose to restrict the number of categories to, for example, 5. This can be done by using the top 4 choices/ options as they are and treating everything else as "other". – Nitesh Nov 18 '14 at 10:23
• Any other way out? – Ankit Haldar Nov 18 '14 at 10:23
• I will probably edit my answer with the above comment. – Nitesh Nov 18 '14 at 10:25
• How do I figure out the top 4 choices? – Ankit Haldar Nov 18 '14 at 10:31

If I've understood your question correctly, one easy solution would be to concatenate the bits together and make a 7-bit binary sequence then convert it to integer. So, for your sample dataset quoted in the question you would get:

 CM 16 0 98 8 6 67