POL 200 Lab 1: Introduction to Stata and Data Management

Introduction to Stata

Overview:

Windows: Results, Variables, Review, Variable Viewer, Command line, Viewer, Data Browser, Data Editor

Do files

Do files are text files which contain a list of Stata commands. When you run a do file, Stata will initiate each command in order. Using do files is a great way to keep track of your commands and is vital to doing reproducible social science.

Accessing Datasets

Stata filenames are always given .dta file types. If the filename ends in .dta, Stata should be able to read it. To open a Stata dataset, do one of the following:

Getting Help

Stata has a nontrivial learning curve: you may need to hunt down how to perform certain functions. You should familiarize yourself with Stata’s help options.

Examining Your Data

Practice

Write a do-file that opens the dataset gss2012_small.dta, runs the table command with options to include frequencies and percentages on the variable earthsun, sorts the data by age, runs the table command again on just those older than 50, and saves the dataset to your H:/. Be sure to save your do-file so you will have access to it later.