Information, Technology & Consulting

Stata Commands

Details

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.

Graphs

  • 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 [email protected].

Topic: 
Research Computing
Subtopic: 
Scientific and Research Software
Last updated: 
Thursday, November 16, 2017

If you have questions or need further information, contact your department's IT support office, or contact the IT Service Desk via email at [email protected], via phone at 603-646-2999 or walk in to see them in Baker/Berry 178J.

Close
Information, Technology & Consulting