Like this?
sysuse auto ,clear
egen median = median(mpg) ,by(rep)
graph box mpg, over(rep, sort(med)) by(fore) name(gr1,replace)
set obs 76
replace fore = 1 in 75/76
replace rep = 1 in 75
replace rep = 2 in 76
replace med = 18 if rep == 2 & fore == 1
replace med = 20 if rep == 1 & fore == 1
graph box mpg, over(rep, sort(med)) by(fore) name(gr2,replace)
Scott
On 8/27/07, Stefan Kreisel <[email protected]> wrote:
> Hi all.
>
> I'll give it another (abbreviated, as suggested in the Statalist FAQ...) try after receiving no response to "Forcing sort order in graph box, over() by()" (see that thread for any details).
>
> Is there a way to individually sort the order of boxes in a given subgraph as produced by the by() option in e.g. -graph box yvar, over(xvar, sort(1)) by(anothergroup)-?
>
> The problem is that missing categories on a given subgrouping of by() get put on the far right most side of the subgraph; I want them all in the same position in each subgraph.
>
> Best regards.
>
> Stefan Kreisel
*
* 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/