Stata Commands


General Commands

  • clear - clears data out of memory.
  • search - searches Stata help for matching strings. This allows you to find help on command statements and return codes which appear alongside of error messages. If you make a mistake with a Stata command, it may return an error message along with a return code {for example, r(199)}. The search command can be used to get a more detailed description of the return code.
  • generate - computes a new variable based on an expression.

Basic Analysis Commands

  • tabulate - gets counts and percents of subgroups for 1 or 2 variables. Summarize option gets summary stats for subgroups.
    tabulate race
    tabulate sex ses
    tabulate race ses, summarize(math)
  • summarize - calculates summary statistics such as mean and standard deviation. Detail option gets more statistics and percentiles. By option gets statistics for subgroups.
    summarize rdg wrtg
    by race: summarize rdg wrtg math, detail (note: race must be sorted first)
  • correlate - displays the correlation matrix for a list of variables. Means option gets summary stats for each variable.
    correlate rdg wrtg math sci civ
    correlate rdg wrtg, means
  • regress - fits a linear regression model of a dependent variable on a single predictor or set of predictors. By the time you're done with this class, you'll know what that means.


  • graph bar - generates a bar chart
  • histogram - generates a histogram
  • graph twoway - generates a two variable scatterplot
  • graph pie - generates a pie chart

Graphs are not written to log files. They must be saved by clicking the File menu, then choose Save Graph.

For questions about using Stata not answered on this page, or for consulting requests regarding statistics, contact Jianjun Hua at 603-646-6552 or


Article ID: 64631
Tue 10/9/18 12:18 PM
Tue 11/12/19 10:12 AM