Plotting Means of a Variable, by Category
catgraph yvar xvar [if exp] [in range] , by(varname) stat(collapse_statistic) graph_options
catgraph plots a summary statistic (means by default) of yvar against xvar, separately for categories of varname.
by(varname) specifies the variable that specifies the categories for plotting. catgraph plots one series for each value of varname. by() may be numeric or string. If by is not specified, one category encompassing all the data is plotted.
stat() specifies the statistic to be plotted. The default is to plot the mean of yvar for each value of xvar. Any valid statistic for the collapse command may be specified.
. catgraph mpg rep78, by(foreign) c(ll) ylab(0,35)
Graphs mean mileage against repair record, separately for foreign and domestic autos.
. catgraph mpg rep78, by(foreign) c(ll) ylab(0,35) stat(median)
Graphs median mileage against repair record, separately for foreign and domestic autos.
Nick Winter Cornell University email@example.com