Announcement

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

  • How to make stata show the "Yes" answers in graphs insted of "No"

    Hi,

    I've been trying to graph some data but Stata keeps represent the group who answered no to the question instead of the one who said yes
    The command was: graph bar (percent) BusinessOwner, over(gender) over(Country_Stage)

    So as I said, the bars in the graph below show the percentage of people who said that they don't own business, and I need the percentage of people who said they own business. Any idea on how i can fix that?

    business - gender - economy.png

    Thank you!


  • #2
    In that case BusinessOwner is surely misnamed. You don't show a data example but perhaps you just need to go


    Code:
    replace BusinessOwner = 1 - BusinessOwner 
    That's a guess. If it doesn't help, https://www.statalist.org/forums/help#stata tells how you to give a decent data example.

    In your case, using graph hbar would cut down on the mess on your categorical axis.

    Comment


    • #3
      I think the problem is not with the coding of BusinessOwner, but rather with the assertion that

      Stata keeps represent the group who answered no to the question
      In fact, what
      Code:
      graph bar (percent) BusinessOwner, over(gender) over(Country_Stage)
      is plotting is the percentage of the non-missing values of BusinessOwner that have each combination of gender and Country_Stage.

      In support of this assertion I will note that in the graph presented, the total in the 6 bars appears to be 100%. Also, while the documentation of (percent) in the output of help graph bar is scant, I'm guessing that the engine behind the graph is the collapse command, and that is what (percent) does in collapse.

      Unfortunately I don't know enough Stata graphics to create the desired graph, nor on reflection am I sure what is wanted. Is it
      • within each combination of gender and Country_Stage, the percentage who are business owners?
      • within each Country_Stage, the percentage of the business owners of each gender, so that the total is 100% within each Country_Stage?
      • something else?

      Comment

      Working...
      X