By

Similar to if, by can be used in combination with a lot of other commands.

One particularly great application is to use it together with different types of graphs (e.g. bar charts, histograms, and scatterplots).

More information
help by

Practical example

Dataset
StataData1.dta
Variable nameeduc
Variable labelEducational level (Age 40, Year 2010)
Value labels1=Compulsory
2=Upper secondary
3=University
Variable namesex
Variable labelSex
Value labels0=Man
1=Woman
graph bar, over(educ) by(sex)

This gives us two bar charts of educational level – one for men and one for women.