Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Amanda Fu <mandy.fu1@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st:graph mean with missing groups |

Date |
Fri, 13 Jul 2012 20:13:20 -0400 |

Hi All, I am stuck with drawing a graph about means of a test score variable by groups. The problem is caused by there are some "empty" groups. The variable "score" range from 0 to 100. I cut it into 10 bands : 0, 1-10, 11-20,21-30,...,91-100. I create a new variable "score_percent" indicates the percent for the share of observations in each band. The data set is like: id score score_percent 1 32 3.8 (Totally 3.8% observations have scores between 31-40) 2 89 23.4 3 67 16.5 ................... I tried to use the following command to create a graph for mean level of test scores: .twoway connected score_percent score ,xlabel(0(10)100) ------------------------- However, in the data set none observations have scores from 11-20. So this is an empty band. The value of "score_percent" for this band should be 0. But if I use the above command to draw the graph, the connected line will skip the empty band and directly jump to the next point (it is like, along the x-axis there are band 0-10, 21-30,.....). What I wanted is to give the empty band with percent share is 0. I wonder if someone can give me some suggestion how to fix this. Thank you! Amanda * * 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/

**Follow-Ups**:**Re: st:graph mean with missing groups***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: Trouble producing population standard deviations with collapse (sd)** - Next by Date:
**st: generating random samples that oversample** - Previous by thread:
**st: aggregation of Fisher's exact test p-values** - Next by thread:
**Re: st:graph mean with missing groups** - Index(es):