Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: graph bar labels with number of observations


From   [email protected]
To   [email protected]
Subject   st: graph bar labels with number of observations
Date   Mon, 19 Feb 2007 23:39:37 -0800 (PST)

Dear Statalist users,

I have the following graph bar code for three categorical variables, var1, var2 
and var3.

graph bar var1, over(var2) over(var3) title("Mean of var1 by var2 and var3")

What I'd like to add is the number of observations that are included in the 
each bar.  I can manually do this with this code:
sort var2 var3;
by var2 var3: summ var1;

The output will give me summary statistics for 9 groups of var1:  all the 
combinations of the three categorical variables: when 0, 1 and missing.

But, how can I incorporate this information in the bar chart above?  
I tried to extract the information manually and go through the blabel option, but I was unsuccessful.  Blabel option can only do a few things: use bar height or names of yvars.

In a histogram, this is easily accomplished: I would use these two options:  frequency and addlabel.  But, how to do it with a graph bar..?

I greatly appreciate your help.

Jelena Zurovac
Graduate Student
University of Washington Seattle





*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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