Bookmark and Share

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

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

st: nested groups for over (or by) in box graph

From   "Ben Hoen" <>
To   <>
Subject   st: nested groups for over (or by) in box graph
Date   Fri, 6 Dec 2013 10:17:14 -0500

Hi all,

I have been toying with this and have not been able to solve it.  Hopefully
it will require a simple solution

I would like to use nested groups in an over option with a box graph.

Here is an example:

sysuse auto, clear
egen pricegroup=cut(price), at(0, 5000,10000, 16000) // this creates
discrete groups.  Not what I want but I will use this for the example.
graph box mpg, over(pricegroup) over(foreign)

* ideally I could create nested groups, like the following, and use them
somehow to produce a similar box graph.
g pricegroup1=(price<5000)
g pricegroup2=(price<10000)
g pricegroup3=(price<16000) //i.e. all cases

* I know this next command will not work but this is what I am imagining
might be possible
graph box mpg, over(pricegroup_*) over(foreign)

Any ideas?

As always, thanks in advance,


Ben Hoen
Staff Research Associate 
Lawrence Berkeley National Laboratory
Office: 845-758-1896
Cell: 718-812-7589

Visit our publications at:

Sign up for our email list to receive publication notifications at:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index