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]
st: RE: RE: Twoway by option
From 
 
Nick Cox <[email protected]> 
To 
 
"'[email protected]'" <[email protected]> 
Subject 
 
st: RE: RE: Twoway by option 
Date 
 
Mon, 21 Mar 2011 17:12:42 +0000 
Another way to do it:
. sysuse auto, clear
(1978 Automobile Data)
. egen mean = mean(mpg) , by(rep78)
. egen group = group(mean rep78)
(5 missing values generated)
. replace group = -group
(69 real changes made)
. labmask group, values(rep78)
etc. 
Notes:
1. The two arguments to -group()- are needed because there might be ties on -mean-. 
2. -labmask- is written up in 
SJ-8-2  gr0034  . . . . . . . . . .  Speaking Stata: Between tables and graphs
        (help labmask, seqvar if installed) . . . . . . . . . . . .  N. J. Cox
        Q2/08   SJ 8(2):269--289
        outlines techniques for producing table-like graphs
Nick 
[email protected] 
Nick Cox
One way to do it is with the -egen- function -axis()- from -egenmore- on SSC. 
. sysuse auto
(1978 Automobile Data)
. egen mean = mean(mpg) , by(rep78)
. egen axis = axis(mean rep78), label(rep78) reverse
(5 missing values generated)
. scatter mpg weight , by(axis)
In your case, I think you need 
egen axis = axis(adv_avg school_name),  reverse label(school_name) 
Steven Archambault
I have been using the below command to generate graphs for  different schools. The graphs appear in alphabetical order of school_name, where I'd rather them be in order of their adv_avg value (highest to lowest). Is there a way to do this?
twoway (connected adv  year if group=="All Students", sort) (line adv_avg year if group=="All Students", sort), ytitle(% Proficient and Above) ///
 xtitle(Years)  by(, title(All Students)) by(school_name, style(compact)) 
*
*   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/