Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How to label bars with frequency AND percentage for categorical variables?


From   Adam Collins <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: How to label bars with frequency AND percentage for categorical variables?
Date   Tue, 24 Nov 2009 16:06:16 +0100

Hello, 

I have a series of categorical variables.  For each one, I would like to create a quick bar graph that displays the count (frequency) of each category, but also the percentage.

For example, if it was an "hbar" graph, it might look something like this:

__________
          | 10
__________|(33.3%)
_________________
                 | 16
_________________|(53.3%)
____
    | 4
____|(13.3%)


I intend to use a "foreach" loop to iterate through the list of categorical variables, so I am looking for a solution that can be automated for each variable in my list.  I don't mind if the solution uses catplot or hbar or something else.

Any ideas?

Thanks a lot in advance!!

Adam



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index