Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Determine how many respondents answered a question where they could select multiple responses

    I am no STATA guru, so this may be simple, but I cannot find guidance anywhere (probably because I don't know how to word my search).

    Where respondents can choose multiple responses, I get data output for each variable in the form of "checked" and "unchecked". Thus I know how many people chose each option. However, because some may have selected multiple options and some may have left the question blank, I don't know how to figure out

    1) how many respondents in total responded (rather than just leaving everything blank) and
    2) how many respondents in each demographic sub-category responded

    I suspect knowing how to calculate 1) may make 2) possible, but I thought I would include it in case it doesn't .

    Thank you for guidance and apologies if this is obvious! Happy to be directed to a help sheet or something to read for myself if you know of one!

    Jane







  • #2
    Use -dataex- to show your data, and explain what you want with a reference to the data you have presented.

    Comment


    • #3
      You leave a lot unspecified, but if the data for the multiple responses are arrayed "wide" (one variable in the dataset for each item in the questionnaire), and if the responses checked and unchecked are coded as one and zero (as opposed to, say, one and missing, or one and minus one), then you could something like the following.
      Code:
      egen int has_checked = rowtotal(<variable list>)
      quietly replace has_checked = has_checked != 0 if !mi(has_checked)
      tabulate has_checked, missing // total respondents
      tabulate sex has_checked, missing // demographic categories
      If the multiple responses are arrayed "long" (one observation per respondent per item), then it's a little trickier, but you'd use something like the following (untested).
      Code:
      bysort respondent_id: generate int has_checked = sum(item == 1)
      quietly by respondent_id: replace has_checked = has_checked[_N]
      by respondent_id: generate byte last = _n == _N
      tabulate has_checked if last, missing
      tabulate has_checked sex if last, missing

      Comment


      • #4
        YES! Thanks for this Joseph Coveney I have now worked through this and it worked perfectly. Thank you, angel Stata man!

        (it was the first lot of code, so my data must have been "wide")

        Comment

        Working...
        X