Dartmouth Research Computing & Data (RCD) logo
  • Home 
  • HPC 
  • AI 
  • Services 
  • Status 
  • Blog 
  • Events 
  • About Us 

  •   Search this site
  •  
  1.   Statistics Software
  1. Home
  2. Research Software
  3. Statistics Software
  4. Stata - Commands

Stata - Commands

On this page
Details   General Commands   Basic Analysis Commands   Graphs  

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 research.computing@dartmouth.edu.

 SPSS for Windows
Stata - Graphing 
On this page:
Details   General Commands   Basic Analysis Commands   Graphs  
Copyright © 2025 Dartmouth Research Computing & Data | Powered by Hinode.
Dartmouth Research Computing & Data (RCD)
Code copied to clipboard