Announcement

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

  • Create bar charts with data in multiple columns

    Hello! I'm using ODK to collect data in the field, for example symptoms experienced by cases, as checkboxes (multiple responses per case). The output is a data table with one column for each symptom. I would like to quickly create a horizontal bar chart to show the frequency of symptoms. What I currently do is to create a separate data table (using Excel's pivot table) which summarizes the frequency of each symptom, then create a chart from there. But I was wondering if it was possible to do it in Stata without going through the intermediate step of creating a summary table for the frequency of symptoms? Attached is an example of my dataset.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str4 interviewer_code byte(all_symptomsfever all_symptomsheadache all_symptomsmalaise all_symptomsmyalgia all_symptomsarthralgia)
    "AB"   1 0 1 1 1
    "AB"   1 0 0 0 0
    "JR"   1 0 0 0 0
    "MGH"  1 0 1 0 0
    "JS"   1 1 0 0 0
    "JS"   1 0 0 0 0
    "Resu" 1 1 1 0 0
    "Resu" 1 0 0 0 0
    "Resu" . . . . .
    "EBR"  1 1 0 0 0
    end
    Last edited by Ian Gonzales; 07 Jun 2022, 00:32.

  • #2
    Code:
    graph bar (sum) all*
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Very simple! Thank you so much!

      Comment

      Working...
      X