Multiple response questions

Dear ODK members

I have a multiple response question stated as "Which methods are you using to protect yourself from acquiring HIV?" and i have answer options with code 1 to 7 for this question. however, in my results CSV file, output of this question appears as a string.
For example if respondent A selected option 1, 2 and 4 on the multiple response question the output in results file is represented as "1 2 4" however i would love the output to appear in binary form with different variables taking on value of 1 and 0. So for the case of this question with 7 answer options, i would like to have an output with 7 different variables column coded with value of 1 for option selected

Is there a way i can achieve this?

<

Certainly possible. Just additional results for each of your 'binaries' and calculate their result based on whether the corresponding value was selected in the response. It'll look something like this (in XML):

  <bind nodeset="/data/answer" type="select"/>
  <bind calculate="selected( /data/answer ,'option_1')" nodeset="/data/option1Selected" type="integer"/>
  <bind calculate="selected( /data/answer ,'option_2')" nodeset="/data/option2Selected" type="integer"/>

and so on...

The key is using the XPath selected() function, which is documented in ODK Bindings

1 Like

This requirement can be fulfilled at the analysis stage. I would assume that you would want to have 7 dummy variables to capture the responses.

1 Like

@Xiphware thank you for the response. Is there a way i can do it in XLSForm directly in the xls file rather than using XML option . I am not familiar with the XML option. Thank you

@Trung its cumbersome to do in the analysis part especially if you have many multiple response questions in your survey

You can create the dummy variable in xls using selected-at function but I would not recommend as it's even more cumbersome as well as making the form a lot heavier unnecessarily.

1 Like

In XLSForm the above XML will look something like this:

XLS

Hope that helps.

2 Likes

Exactly, by disaggregating the multiple select string variable. If you are using stata or R, its quite straight forward