{smcl} {* 3dec2008}{...} {hline} help for {hi:byhist} {hline} {title:Graph interlaced histograms: for comparing histograms by a categorical variable} {p 4 12 2} {cmd:byhist} {it:varname} {ifin} {weight} [{cmd:, by(}{it:varname}{cmd:)} { {cmdab:freq:uency} |{cmdab:frac:tion} | {cmdab:dens:ity} } {cmd:name(}{help name_option}{cmd:)} {cmd:tw(}{help twoway_options}{cmd:)}] {title:Description} {p 4 4 2} {cmd:byhist} makes histograms, with frequencies (optionally fraction/density) of one variable optionally shown by categories of another variable. fweights, aweights, and pweights are allowed (at user's own risk). {title:Options} {p 4 8 2}{cmd:by} specifies a variable by which to compute histograms. Options after a comma within the parentheses are passed to {help twoway_bar}.{p_end} {p 4 8 2}{cmdab:freq:uency} |{cmdab:frac:tion} | {cmdab:dens:ity} are as in {help histogram}. {p_end} {p 4 8 2}{cmd:name} names the graph something other than "Graph"; see {help name_option}. {p_end} {p 4 8 2}{cmd:tw(}{help twoway_options}{cmd:)} passes options to {help twoway_bar}. Note that options passed by default may be superseded in this way, for example {help axis_options:y axis labels}, but some added options may be ignored as a result of existing options (e.g. {help axis_options:yscale} will not override the range specified by the existing {help axis_options:y axis labels}). {p_end} {p 4 8 2}{cmd:tw?(}{help twoway_options}{cmd:)} passes options to {help twoway_bar}. This is a set of options {cmd:tw1(}{help twoway_options}{cmd:)}, {cmd:tw2(}{help twoway_options}{cmd:)}, {cmd:tw3(}{help twoway_options}{cmd:)}, et cetera, that pass {help twoway_options} to the first set of bars, the second set of bars, the third set of bars, and so on. See the second example below. {p_end} {p 4 8 2}Other options are passed to {help twoway__histogram_gen}. {p_end} {title:Examples} {p 4 8 2}{stata "sysuse auto, clear":sysuse auto, clear}{p_end} {p 4 8 2}{stata "byhist mpg, by(foreign)":byhist mpg, by(foreign)}{p_end} {p 4 8 2}{stata "sysuse nlsw88, clear":sysuse nlsw88, clear}{p_end} {p 4 8 2}{stata "byhist wage [fw=hours], by(married) frac":byhist wage [fw=hours], by(married) frac}{p_end} {p 4 8 2}{stata `"la var married """':la var married ""}{p_end} {p 4 8 2}{stata "byhist wage [fw=hours], by(married) frac":byhist wage [fw=hours], by(married) frac}{p_end} {p 4 8 2}{stata "byhist wage [fw=hours], by(married) frac tw1(color(blue)) tw2(color(cyan))":byhist wage [fw=hours], by(married) frac tw1(color(blue)) tw2(color(cyan))}{p_end} {title:Author} {p 4 4 2} Austin Nichols{break} austinnichols@gmail.com {title:Also see:} {p 1 14 2}Manual: {hi:[R] graph twoway bar}{p_end} {p 1 14 2} Online: help for {help histogram}, {stata "view help twoway bar##remarks3":twoway bar}; {help bihist} (if installed; {stata "ssc inst byhist, replace":install}){p_end}