Announcement

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

  • Creating Histogram/graph bar with number of counts on y and percentage label on bar on x axis

    I'm probably looking for something straight forward. I want to create a histogram/graph bar of a categorical variable with the count of patients on the y axis but the bars having the percentage on top of each bar. I have tried several options (screenshots attached) but haven't managed to get the combination (attached as "aim").

    Any ideas?

    ​​​​​​​Many thanks
    I'm probably looking for something straight forward. I want to create a histogram/graph bar of a categorical variable with the count of patients on the y axis but the bars having the percentage on top of each bar. I have tried several options (screenshots attached) but haven't managed to get the combination (attached as "aim").

    Any ideas?

    ​​​​​​​Many thanks
    Attached Files

  • #2
    Perhaps someone with more experience that I will know from your graphs which of the many Stata Graph commands you used to attain what you have, and will know how to modify it to achieve what you want. If no such member is able to respond, you can cast your net more widely by showing the commands you used to create the two unsatisfactory graphs, so that those of us with less experience can try our hand at the problem without having to spend time trying to reproduce your starting point.

    The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

    Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

    Section 12.1 is particularly pertinent

    12.1 What to say about your commands and your problem

    Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
    You've shown us Stata's response, but not your commands.

    Comment


    • #3
      Dear William,

      uh, sorry. True. I usually do add the code. Apologies for that. I used:

      graph bar (count), over(BNI) blabel(bar)
      -> that gives me the first graph from above

      graph bar, over(BNI) blabel(bar)
      -> that give me the second graph

      I would like to have the count on the L side instead of the frequency as is depicted on the third graph. And also, once I would manage that I would like to be able to change the distance of the scale distance (in the third graph the count is much more frequent (absolute number of patients) than on the one I managed to create).

      Any help would be much appreciated.

      Comment

      Working...
      X