Binary Variable Histogram in Stata

A binary variable histogram draws a histogram of a single continuous or categorical variable, with the bars separated by the two values of a given binary variable.

To create a binary variable histogram in Stata you first need to download the byhist command from the SSC, which you do using the following command in Stata:

ssc install byhist

To generate this graph in Stata, use the following commands:

sysuse auto, clear
byhist mpg, by(foreign)