In some versions of Stata,
there is a potential 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:
sort index.
Then, the data are back in the original order.
Here is a list of the commands demonstrated above and 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 |
| edit | better alternative to input for Macs |
| exit | leave Stata |
| generate | creates new variables (e.g., generate years = last - first) |
| graph | general graphing command (this command has many options) |
| help | online help |
| histogram | create a histogram graphic |
| if | lets you select a subset of observations (e.g., list if radius >= 3000) |
| infile | read non-Stata-format dataset (ASCII or text file) |
| input | type in raw data |
| insheet | read non-Stata-format spreadsheet with variable names on first line |
| list | lists the whole dataset in memory (you can also list only certain variables) |
| log | save or print Stata ouput (except graphs) |
| lookup | keyword search of commands, often precursor to help |
| oneway | oneway analysis of variance |
| pcorr | partial correlation coefficients |
| plot | text-mode (crude) scatterplots |
| predict | calculated predicted values (y-hat), residuals (ordinary, standardized and studentized), leverages, Cook's distance, standard error of predicted individual y, standard error of predicted mean y, standard error of residual from regression |
| qnorm | create a normal quantile plot |
| regress | regression |
| replace | lets you change individual values of a variable |
| save | saves data and labels in a Stata-format dataset |
| scatter | create a scatter plot of two numerical variables |
| set | set Stata system parameters (e.g., obs and seed) |
| sebarr | standard error-bar chart |
| sort | sorts observations from smallest to largest |
| stem | stem and leaf display |
| summarize | produces summary statistics (# obs, mean, sd, min, max) (has a detail option) |
| tabstat | produces summary statistics of your choice |
| tabulate | produces counts/frequencies for categorical data |
| test | conducts various hypothesis tests (refers back to most recent model fit (e.g., regress or anova ) (see help function for info and examples)) |
| ttest | one and two-sample t-tests |
| use | retrieve previously saved Stata dataset |