Create a Set of Graph Panels by Multiple Categorical Variables
You can use the egen command to generate a variable containing categories that combine several other categories. In this example, the group variable is created to break down the rep78 variable by the foreign variable. As the foreign variable has two categories and the rep78 variable has five categories, you end up with ten total categories in your subsequent group variable. You can then use the by() option on your graphs to break down by this single categorical variable, which is really breaking everything down by two categories.
To generate this graph in Stata, use the following commands: