Announcement

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

  • Working with Yes/No values in stata

    Hello Everyone,

    I'm currently working on a project where I'm comparing a yes/no variable (ecprior) to a categorical income variable (FamilyIncome). I'm trying to make a bar graph that shows what percentage of people answered "Yes" to ecprior in each income category. So far I've only been able to make a bar graph which measures the people who answered "yes" as a percentage of the whole sample, and I want to make it so it's the percentage of people who answered "Yes" in each individual category. I'm not really sure how to go about doing this is STATA, does anyone have any advice?

    Thank you in advance,

    Evan

  • #2
    Hi Evan, I'm wondering if this example is helpful: https://www.stata.com/support/faqs/g...ble/index.html.

    Comment


    • #3

      Please note https://www.statalist.org/forums/help#stata (data example please!) and in passing https://www.statalist.org/forums/help#spelling

      This code, which you can run, should suggest something for your case. The percent foreign is just the mean of a binary variable, modulo axis labels that show numbers as you desire.

      Code:
      sysuse auto, clear
      set scheme s1color
      graph bar (mean) foreign, over(rep78) ytitle(% foreign) yla(0 0.25 "25" 0.5 "50" 0.75 "75" 1 "100", ang(h))

      Comment

      Working...
      X