Stata Commands
Stata Commands
galton.uchicago.edu/~eichler/stat22000/Handouts/stata-commands.html 1/3
7/8/23, 1:29 PM Stata Commands
There is a glitch with Stata's "stem" command for stem-and-leaf plots. The "stem" function seems to permanently reorder the data so
that they are sorted according to the variable that the stem-and-leaf plot was plotted for. The best way to avoid this problem is to avoid
doing any stem-and-leaf plots (do histograms instead). However, if you really want to do a stem-and-leaf plot you should always
create a variable containing the original observation numbers (called "index", for example). A command to do so is: generate index =
_n
If you do this, then you can re-sort the data after the stem-and-leaf plot according to the index variable (Stata command: sort index )
so that the data is back in the original order.
Commands: Here are some other commands that you may find useful (this is by no means an exhaustive list of all Stata commands):
anova general ANOVA, ANCOVA, or regression
by repeat operation for categories of a variable
ci confidence intervals for means
clear clears previous dataset out of memory
correlate correlation between variables
describe briefly describes the data (# of obs, variable names, etc.)
diagplot distribution diagnostic plots
drop eliminate variables from memory
galton.uchicago.edu/~eichler/stat22000/Handouts/stata-commands.html 2/3
7/8/23, 1:29 PM Stata Commands
galton.uchicago.edu/~eichler/stat22000/Handouts/stata-commands.html 3/3