PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer. Stata Basics for PAM 4280/ECON 3710

Size: px
Start display at page:

Download "PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer. Stata Basics for PAM 4280/ECON 3710"

Transcription

1 PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer Stata Basics for PAM 4280/ECON 3710 I Introduction Stata is one of the most commonly used statistical software packages among economists because of its breadth of estimation commands and quality graphics You will use Stata for all homework assignments and your research paper Stata/MP (Version 14) is available from CISER; you can connect to the CISER research servers from any computer ( In addition, computers with Stata are available in the following Mann Library computer labs: Stone, B30A and B30B In these notes, I summarize the features of Stata and I provide examples of the most commonly used commands Additionally, I discuss the National Longitudinal Study of Adolescent to Adult Health (Add Health) and the commands you will need to use to correctly analyze these survey data Stata syntax is highlighted in blue and examples are shown in text boxes II Stata interface The Stata interface includes separate panels for writing commands, reporting output, reviewing previous commands, and listing properties of the data in memory In addition to the primary panels, you should also use the help, do- file, and data buttons to initiate secondary panels with the help menu, do- file editor, and data browser, respectively 1

2 You can interact with Stata directly by typing commands into the command line However, you should always save your commands as a do file for future use and replication A do file is simply a text file with the commands you wish to execute listed sequentially 2

3 You can execute a do file directly from the do- file editor You also can execute do files outside of the Stata interface by typing the following command into your command prompt or terminal stata b do filename & III Stata files Below is a list of the different types of Stata files You will need to open Stata data files (dta), write do files, and save the log of your output (log) do Stata commands saved in text file dta Stata data file log Log file with output from Stata commands gph Graph file ado Program (every Stata command has an associated ado file) Logs By default, Stata saves log files in the Stata Markup and Control Language (SMCL) format The SMCL format is viewed correctly from the do- file editor only Therefore, I recommend that you change the format of your log file to plain text Plain text log files can be saved with either the log or txt suffix set logtype text log using filename, replace log close log using "PAM4280_Fall2015_Logtxt", text replace log close IV Basic commands These basic Stata commands are useful at the beginning of your do file clear all clear everything from memory set more {on off} pause until any key is pressed (on or off) #delimit {cr ;} change the delimiter from carriage return to semi- colon The trace command will trace the execution of programs (ado) This command is best used for troubleshooting errors, but it creates lots output, most of which is unnecessary set trace {on off} trace execution of programs (on or off) 3

4 The exit command (exit) terminates the current process Include the exit command at the end of your do file to return to the command line in the primary panel You also can use the exit command to terminate a process within a loop, for example There are two ways to include comments in your do file First, you can start a new line with either an asterisk (*) or two forward slashes (//) Second, you can write a comment between /* and */; this format allows you to wrap comments over multiple lines clear all set more off * Example of a comment in a do file /* Example of a multi-line comment in a do file */ The help command launches a viewer to display the Stata help page You can also launch the help page for a specific command (help command) Each help page lists the command syntax, description, options, and examples Most Stata help pages are also available online Google Stata help command For example, Stata help use yields the following URL ( 4

5 V Data Loading data The data posted on Blackboard for your homework assignments and research paper is in Stata format (PAM4280_Fall2015_Datadta) The use command loads a Stata- formatted data file (dta) into memory use filename, clear The data file should be in your current directory or you will need to include the file path with the filename You can check your current directory by typing pwd (present working directory) in the command window You also can change your current directory by typing cd directory_path cd "\\rschfs1x\userrs\cnc45_rs\documents\pam4280"; use "PAM4280_PS_Datadta", clear; Merging data You may wish to add additional variables or waves of data to the Add Health file for your research paper To merge the Wave IV Add Health data with other waves of data, use the one- to- one merge command merge 1:1 [varlist] using filename [, keepusing(varlist)] The merge match results are saved in the _merge system variable You can either assert a required match as a command option or you can use the keep command to save the desired match results [, assert(results)] 1 master Appeared in master only 2 using Appeared in using only 3 match Appeared in both merge 1:1 AID using "AddHealth_WaveIII_testsdta", keepusing(pvtstd3c); keep if inlist(_merge,1,3); drop _merge; Generating new variables You will need to generate new variables in the homework assignments Use the generate and replace commands to create new variables gen newvar = exp replace oldvar = exp [if] 5

6 gen male = BIO_SEX4 == 1; gen blackwhite = ; replace blackwhite = 0 if white == 1; replace blackwhite = 1 if black == 1; VI Add Health data For all homework assignments and your research paper, you will use publicly available data from Wave IV of the National Longitudinal Study of Adolescent to Adult Health (Add Health) Add Health is a longitudinal survey administered by the University of North Carolina at Chapel Hill, and it is designed for the study of the health and behaviors of American adolescents and young adults Detailed information about the data is available on the Add Health website: 6

7 The Add Health data are based on a stratified random sample of all high schools in the US The in- home sample comprises a main sample of adolescents from each community as well as selected oversamples Declare survey data Your estimates would be biased if you did not account for the sample design of the Add Health study Stata has a well- established set of commands that will automatically adjust your estimates after you declare the survey design To declare the survey design, you must give Stata the primary sampling units (aka, clusters) and the probability weights svyset [psu] [weight] [, options] svyset CLUSTER2 [pweight= GSWGT4_2]; svydescribe; svydescribe; Survey: Describing stage 1 sampling units pweight: GSWGT4_2 VCE: linearized Single unit: missing 7

8 Strata 1: <one> SU 1: CLUSTER2 FPC 1: <zero> #Obs per Unit Stratum #Units #Obs min mean max , , VII Describe data Before you begin analyzing the Add Health data, you should use these commands to review the contents of the data file desc [varlist] describe the data in memory mdesc varlist describe missing values summ [varlist] summary statistics tab varname One- way table of frequencies tab varname1 varname2 Two- way table of frequencies VIII Analyze data The homework assignments require that you estimate and interpret means, linear regressions, and probit models mean varlist [, over(varlist)] reg depvar [indepvar] probit depvar [indepvar] Recall that a probit model fits the following Pr y! 0 x! = Φ(x! β) where Φ is the cumulative distribution function of the standard normal distribution Stata stores some results in memory after a command is executed (eg, vector of means) Two of the most commonly used stored results are the coefficient and the standard error (_b[varname] and _se[varname]) Use the following postestimation commands to review the complete list of stored results return list return stored results ereturn list return estimation results Survey data To adjust your estimated means and coefficients for the sample design of the Add Health study, type your Stata command after the svy prefix Review the Stata Survey Data Reference Manual for a complete list of the available survey commands 8

9 svy: command Many of the estimates that you will be asked to produce in the homework assignments are among a subsample of the Add Health survey respondents For example, you will be asked about condom use among young adults who have ever had sex The correct way to estimate results for a subsample of observations is to use the subpopulation option (subpop) with the svy prefix Other methods (eg, if statements) will incorrectly identify the number of primary sampling units and therefore produce biased variance calculations svy, subpop([varname]): command svy, subpop(sex_12m): mean condom_12m, over(gender); svy, subpop(sex_12m): mean condom_12m, over(gender); (running mean on estimation sample) Survey: Mean estimation Number of strata = 1 Number of obs = 4,901 Number of PSUs = 132 Population size = 21,071,729 Subpop no obs = 4,362 Subpop size = 18,690,865 Design df = 131 Male: gender = Male Female: gender = Female Linearized Over Mean Std Err [95% Conf Interval] condom_12m Male Female IX Postestimation You will use postestimation commands to construct estimates of marginal effects and elasticities, as well as hypothesis testing Use the margins command to estimate marginal effects and elasticities The marginal effect of an independent variable is the derivative of the probability function (ie, the derivative of Pr y! 0 x! = Φ(x! β) with respect to x) By default, Stata evaluates the margins command for each observation and reports the average Use the vce(unconditional) option to tell Stata to allow for the sampling of covariates; this option is required to correctly estimate standard errors from survey data margins, vce(unconditional) dydx(varlist) margins, vce(unconditional) eyex(varlist) atmeans 9

10 The standard postestimation command for t- tests (ttest) is not available after a svy command Use the lincom (linear combination) command to calculate a t- test for the null hypothesis that two coefficients are equal (eg, H! : β!"#$ β!"#$%" = 0) lincom _b[varname1] - _b[varname2] X Save results There are a number of different methods for saving your results to Word or Excel The homework assignment solutions will utilize both outreg and putexcel outreg [varlist] using filename outreg using "PAM4280_Fall2015_Tablesdoc", se replace title("table title") ctitle("",ctitle1); outreg using "PAM4280_Fall2015_Tablesdoc", se merge title("table title") ctitle("",ctitle1); putexcel set filename, modify [, keepcellformat] putexcel cellexplist putexcel set PAM4280_Fall2015_PSxlsx, sheet( PS ) keepcellformat modify; putexcel A1 = matrix(_b[male],_se[male]); 10

11 References Analyzing data from sample surveys UNC: Carolina Population Center, Carmeron, C A, & Triveda, P K (2010) Microeconomics Using Stata, Revised Edition StataCorp LP College Station, Texas Gentzkow, M, & Shapiro, J M (2014) Code and Data for the Social Sciences: A Practitioner s Guide University of Chicago mimeo, Introduction to Stata UNC: Carolina Population Center, Long, J S (2009) The Workflow of Data Analysis Using Stata StataCorp LP College Station, Texas The National Longitudinal Study of Adolescent to Adult Health (Add Health) UNC: Carolina Population Center, Resources to help you learn and use Stata UCLA: Statistical Consulting Group, Rodriguez, G (2015) Stata Tutorial Princeton University, StataCorp (2013) Stata Survey Data Reference Manual: Release 13 Statistical Software College Station, TX: StataCorp LP 11

Title. Syntax. svy: tabulate oneway One-way tables for survey data. Basic syntax. svy: tabulate varname. Full syntax

Title. Syntax. svy: tabulate oneway One-way tables for survey data. Basic syntax. svy: tabulate varname. Full syntax Title svy: tabulate oneway One-way tables for survey data Syntax Basic syntax svy: tabulate varname Full syntax svy [ vcetype ] [, svy options ] : tabulate varname [ if ] [ in ] [, tabulate options display

More information

GETTING DATA INTO THE PROGRAM

GETTING DATA INTO THE PROGRAM GETTING DATA INTO THE PROGRAM 1. Have a Stata dta dataset. Go to File then Open. OR Type use pathname in the command line. 2. Using a SAS or SPSS dataset. Use Stat Transfer. (Note: do not become dependent

More information

STATA TUTORIAL B. Rabin with modifications by T. Marsh

STATA TUTORIAL B. Rabin with modifications by T. Marsh STATA TUTORIAL B. Rabin with modifications by T. Marsh 5.2.05 (content also from http://www.ats.ucla.edu/stat/spss/faq/compare_packages.htm) Why choose Stata? Stata has a wide array of pre-defined statistical

More information

Empirical Asset Pricing

Empirical Asset Pricing Department of Mathematics and Statistics, University of Vaasa, Finland Texas A&M University, May June, 2013 As of May 17, 2013 Part I Stata Introduction 1 Stata Introduction Interface Commands Command

More information

Bivariate (Simple) Regression Analysis

Bivariate (Simple) Regression Analysis Revised July 2018 Bivariate (Simple) Regression Analysis This set of notes shows how to use Stata to estimate a simple (two-variable) regression equation. It assumes that you have set Stata up on your

More information

Correctly Compute Complex Samples Statistics

Correctly Compute Complex Samples Statistics SPSS Complex Samples 15.0 Specifications Correctly Compute Complex Samples Statistics When you conduct sample surveys, use a statistics package dedicated to producing correct estimates for complex sample

More information

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata..

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata.. Introduction to Stata 2016-17 01. First Session I- Launching and Exiting Stata... 1. Launching Stata... 2. Exiting Stata.. II - Toolbar, Menu bar and Windows.. 1. Toolbar Key.. 2. Menu bar Key..... 3.

More information

A Short Guide to Stata 10 for Windows

A Short Guide to Stata 10 for Windows A Short Guide to Stata 10 for Windows 1. Introduction 2 2. The Stata Environment 2 3. Where to get help 2 4. Opening and Saving Data 3 5. Importing Data 4 6. Data Manipulation 5 7. Descriptive Statistics

More information

A quick introduction to STATA

A quick introduction to STATA A quick introduction to STATA Data files and other resources for the course book Introduction to Econometrics by Stock and Watson is available on: http://wps.aw.com/aw_stock_ie_3/178/45691/11696965.cw/index.html

More information

Introduction to Stata - Session 2

Introduction to Stata - Session 2 Introduction to Stata - Session 2 Siv-Elisabeth Skjelbred ECON 3150/4150, UiO January 26, 2016 1 / 29 Before we start Download auto.dta, auto.csv from course home page and save to your stata course folder.

More information

A Quick Guide to Stata 8 for Windows

A Quick Guide to Stata 8 for Windows Université de Lausanne, HEC Applied Econometrics II Kurt Schmidheiny October 22, 2003 A Quick Guide to Stata 8 for Windows 2 1 Introduction A Quick Guide to Stata 8 for Windows This guide introduces the

More information

Soci Statistics for Sociologists

Soci Statistics for Sociologists University of North Carolina Chapel Hill Soci708-001 Statistics for Sociologists Fall 2009 Professor François Nielsen Stata Commands for Module 7 Inference for Distributions For further information on

More information

Introduction to STATA

Introduction to STATA Introduction to STATA Duah Dwomoh, MPhil School of Public Health, University of Ghana, Accra July 2016 International Workshop on Impact Evaluation of Population, Health and Nutrition Programs Learning

More information

Dr. Barbara Morgan Quantitative Methods

Dr. Barbara Morgan Quantitative Methods Dr. Barbara Morgan Quantitative Methods 195.650 Basic Stata This is a brief guide to using the most basic operations in Stata. Stata also has an on-line tutorial. At the initial prompt type tutorial. In

More information

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany STATA Tutorial to Accompany Introduction to Econometrics by James H. Stock and Mark W. Watson STATA Tutorial to accompany Stock/Watson Introduction to Econometrics Copyright 2003 Pearson Education Inc.

More information

An Introduction to Stata Part II: Data Analysis

An Introduction to Stata Part II: Data Analysis An Introduction to Stata Part II: Data Analysis Kerry L. Papps 1. Overview Do-files Sorting a dataset Combining datasets Creating a dataset of means or medians etc. Weights Panel data capabilities Dummy

More information

HILDA PROJECT TECHNICAL PAPER SERIES No. 2/08, February 2008

HILDA PROJECT TECHNICAL PAPER SERIES No. 2/08, February 2008 HILDA PROJECT TECHNICAL PAPER SERIES No. 2/08, February 2008 HILDA Standard Errors: A Users Guide Clinton Hayes The HILDA Project was initiated, and is funded, by the Australian Government Department of

More information

Introduction to Stata: An In-class Tutorial

Introduction to Stata: An In-class Tutorial Introduction to Stata: An I. The Basics - Stata is a command-driven statistical software program. In other words, you type in a command, and Stata executes it. You can use the drop-down menus to avoid

More information

Introduction to Stata Session 3

Introduction to Stata Session 3 Introduction to Stata Session 3 Tarjei Havnes 1 ESOP and Department of Economics University of Oslo 2 Research department Statistics Norway ECON 3150/4150, UiO, 2015 Before we start 1. In your folder statacourse:

More information

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice.

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice. I Launching and Exiting Stata 1. Launching Stata Stata can be launched in either of two ways: 1) in the stata program, click on the stata application; or 2) double click on the short cut that you have

More information

An Introduction to Stata Part I: Data Management

An Introduction to Stata Part I: Data Management An Introduction to Stata Part I: Data Management Kerry L. Papps 1. Overview These two classes aim to give you the necessary skills to get started using Stata for empirical research. The first class will

More information

Instrumental variables, bootstrapping, and generalized linear models

Instrumental variables, bootstrapping, and generalized linear models The Stata Journal (2003) 3, Number 4, pp. 351 360 Instrumental variables, bootstrapping, and generalized linear models James W. Hardin Arnold School of Public Health University of South Carolina Columbia,

More information

OVERVIEW OF WINDOWS IN STATA

OVERVIEW OF WINDOWS IN STATA OBJECTIVES OF STATA This course is the series of statistical analysis using Stata. It is designed to acquire basic skill on Stata and produce a technical reports in the statistical views. After completion

More information

Multiple-imputation analysis using Stata s mi command

Multiple-imputation analysis using Stata s mi command Multiple-imputation analysis using Stata s mi command Yulia Marchenko Senior Statistician StataCorp LP 2009 UK Stata Users Group Meeting Yulia Marchenko (StataCorp) Multiple-imputation analysis using mi

More information

Getting started with Stata 2017: Cheat-sheet

Getting started with Stata 2017: Cheat-sheet Getting started with Stata 2017: Cheat-sheet 4. september 2017 1 Get started Graphical user interface (GUI). Clickable. Simple. Commands. Allows for use of do-le. Easy to keep track. Command window: Write

More information

ECONOMICS 351* -- Stata 10 Tutorial 1. Stata 10 Tutorial 1

ECONOMICS 351* -- Stata 10 Tutorial 1. Stata 10 Tutorial 1 TOPIC: Getting Started with Stata Stata 10 Tutorial 1 DATA: auto1.raw and auto1.txt (two text-format data files) TASKS: Stata 10 Tutorial 1 is intended to introduce (or re-introduce) you to some of the

More information

Basic Stata Tutorial

Basic Stata Tutorial Basic Stata Tutorial By Brandon Heck Downloading Stata To obtain Stata, select your country of residence and click Go. Then, assuming you are a student, click New Educational then click Students. The capacity

More information

ECON Stata course, 3rd session

ECON Stata course, 3rd session ECON4150 - Stata course, 3rd session Andrea Papini Heavily based on last year s session by Tarjei Havnes February 4, 2016 Stata course, 3rd session February 4, 2016 1 / 19 Before we start 1. Download caschool.dta

More information

Introduction to Stata Toy Program #1 Basic Descriptives

Introduction to Stata Toy Program #1 Basic Descriptives Introduction to Stata 2018-19 Toy Program #1 Basic Descriptives Summary The goal of this toy program is to get you in and out of a Stata session and, along the way, produce some descriptive statistics.

More information

A QUICK INTRODUCTION TO STATA

A QUICK INTRODUCTION TO STATA A QUICK INTRODUCTION TO STATA This module provides a quick introduction to STATA. After completing this module you will be able to input data, save data, transform data, create basic tables, create basic

More information

Week 4: Simple Linear Regression II

Week 4: Simple Linear Regression II Week 4: Simple Linear Regression II Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline Algebraic properties

More information

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva Econ 329 - Stata Tutorial I: Reading, Organizing and Describing Data Sanjaya DeSilva September 8, 2008 1 Basics When you open Stata, you will see four windows. 1. The Results window list all the commands

More information

Revision of Stata basics in STATA 11:

Revision of Stata basics in STATA 11: Revision of Stata basics in STATA 11: April, 2016 Dr. Selim Raihan Executive Director, SANEM Professor, Department of Economics, University of Dhaka Contents a) Resources b) Stata 11 Interface c) Datasets

More information

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES GETTING STARTED WITH STATA Sébastien Fontenay ECON - IRES THE SOFTWARE Software developed in 1985 by StataCorp Functionalities Data management Statistical analysis Graphics Using Stata at UCL Computer

More information

Department of Economics Spring 2018 University of California Economics 154 Professor Martha Olney Stata Lesson Thursday February 15, 2018

Department of Economics Spring 2018 University of California Economics 154 Professor Martha Olney Stata Lesson Thursday February 15, 2018 University of California Economics 154 Berkeley Professor Martha Olney Stata Lesson Thursday February 15, 2018 [1] Where to find the data sets http://www.econ.berkeley.edu/~olney/spring18/econ154 There

More information

Introduction to Stata. Getting Started. This is the simple command syntax in Stata and more conditions can be added as shown in the examples.

Introduction to Stata. Getting Started. This is the simple command syntax in Stata and more conditions can be added as shown in the examples. Getting Started Command Syntax command varlist, option This is the simple command syntax in Stata and more conditions can be added as shown in the examples. Preamble mkdir tutorial /* to create a new directory,

More information

An Introductory Guide to Stata

An Introductory Guide to Stata An Introductory Guide to Stata Scott L. Minkoff Assistant Professor Department of Political Science Barnard College sminkoff@barnard.edu Updated: July 9, 2012 1 TABLE OF CONTENTS ABOUT THIS GUIDE... 4

More information

STATA May 1996 BULLETIN A publication to promote communication among Stata users

STATA May 1996 BULLETIN A publication to promote communication among Stata users STATA May 1996 TECHNICAL BULLETIN STB-31 A publication to promote communication among Stata users Editor Associate Editors H. Joseph Newton Francis X. Diebold, University of Pennsylvania Department of

More information

Appendix II: STATA Preliminary

Appendix II: STATA Preliminary Appendix II: STATA Preliminary STATA is a statistical software package that offers a large number of statistical and econometric estimation procedures. With STATA we can easily manage data and apply standard

More information

Economics 145 Fall 2009 Howell Getting Started with Stata

Economics 145 Fall 2009 Howell Getting Started with Stata Getting Started with Stata This simple introduction to Stata will allow you to open a dataset and conduct some basic analyses similar to those that we have discussed in Excel. For those who would like

More information

A quick introduction to STATA:

A quick introduction to STATA: 1 Revised September 2008 A quick introduction to STATA: (by E. Bernhardsen, with additions by H. Goldstein) 1. How to access STATA from the pc s at the computer lab After having logged in you have to log

More information

/23/2004 TA : Jiyoon Kim. Recitation Note 1

/23/2004 TA : Jiyoon Kim. Recitation Note 1 Recitation Note 1 This is intended to walk you through using STATA in an Athena environment. The computer room of political science dept. has STATA on PC machines. But, knowing how to use it on Athena

More information

Principles of Biostatistics and Data Analysis PHP 2510 Lab2

Principles of Biostatistics and Data Analysis PHP 2510 Lab2 Goals for Lab2: Familiarization with Do-file Editor (two important features: reproducible and analysis) Reviewing commands for summary statistics Visual depiction of data- bar chart and histograms Stata

More information

Correctly Compute Complex Samples Statistics

Correctly Compute Complex Samples Statistics PASW Complex Samples 17.0 Specifications Correctly Compute Complex Samples Statistics When you conduct sample surveys, use a statistics package dedicated to producing correct estimates for complex sample

More information

Stata v 12 Illustration. First Session

Stata v 12 Illustration. First Session Launch Stata PC Users Stata v 12 Illustration Mac Users START > ALL PROGRAMS > Stata; or Double click on the Stata icon on your desktop APPLICATIONS > STATA folder > Stata; or Double click on the Stata

More information

Acknowledgments. Acronyms

Acknowledgments. Acronyms Acknowledgments Preface Acronyms xi xiii xv 1 Basic Tools 1 1.1 Goals of inference 1 1.1.1 Population or process? 1 1.1.2 Probability samples 2 1.1.3 Sampling weights 3 1.1.4 Design effects. 5 1.2 An introduction

More information

Review of Stata II AERC Training Workshop Nairobi, May 2002

Review of Stata II AERC Training Workshop Nairobi, May 2002 Review of Stata II AERC Training Workshop Nairobi, 20-24 May 2002 This note provides more information on the basics of Stata that should help you with the exercises in the remaining sessions of the workshop.

More information

Data Management 2. 1 Introduction. 2 Do-files. 2.1 Ado-files and Do-files

Data Management 2. 1 Introduction. 2 Do-files. 2.1 Ado-files and Do-files University of California, Santa Cruz Department of Economics ECON 294A (Fall 2014)- Stata Lab Instructor: Manuel Barron 1 Data Management 2 1 Introduction Today we are going to introduce the use of do-files,

More information

Stata 10/11 Tutorial 1

Stata 10/11 Tutorial 1 Stata 1/11 Tutorial 1 TOPIC: Estimation and Hypothesis Testing in Linear Regression Models: A Review DATA: auto1.raw and auto1.txt auto1.dta (two text-format (ASCII) data files) (a Stata-format dataset)

More information

Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000

Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000 Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000 This lab is designed to give you a basic understanding of the tools available

More information

Week 10: Heteroskedasticity II

Week 10: Heteroskedasticity II Week 10: Heteroskedasticity II Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline Dealing with heteroskedasticy

More information

Analysis of Complex Survey Data with SAS

Analysis of Complex Survey Data with SAS ABSTRACT Analysis of Complex Survey Data with SAS Christine R. Wells, Ph.D., UCLA, Los Angeles, CA The differences between data collected via a complex sampling design and data collected via other methods

More information

STATA Hand Out 1. STATA's latest version is version 12. Most commands in this hand-out work on all versions of STATA.

STATA Hand Out 1. STATA's latest version is version 12. Most commands in this hand-out work on all versions of STATA. STATA Hand Out 1 STATA Background: STATA is a Data Analysis and Statistical Software developed by the company STATA-CORP in 1985. It is widely used by researchers across different fields. STATA is popular

More information

Ninth ARTNeT Capacity Building Workshop for Trade Research "Trade Flows and Trade Policy Analysis"

Ninth ARTNeT Capacity Building Workshop for Trade Research Trade Flows and Trade Policy Analysis Ninth ARTNeT Capacity Building Workshop for Trade Research "Trade Flows and Trade Policy Analysis" June 2013 Bangkok, Thailand Cosimo Beverelli and Rainer Lanz (World Trade Organization) 1 Introduction

More information

ICSSR Data Service. Stata: User Guide. Indian Council of Social Science Research. Indian Social Science Data Repository

ICSSR Data Service. Stata: User Guide. Indian Council of Social Science Research. Indian Social Science Data Repository http://www.icssrdataservice.in/ ICSSR Data Service Indian Social Science Data Repository Stata: User Guide Indian Council of Social Science Research ICSSR Data Service Contents: 1. Introduction 1 2. Opening

More information

Introduction to Stata. Written by Yi-Chi Chen

Introduction to Stata. Written by Yi-Chi Chen Introduction to Stata Written by Yi-Chi Chen Center for Social Science Computation & Research 145 Savery Hall University of Washington Seattle, WA 98195 U.S.A (206)543-8110 September 2002 http://julius.csscr.washington.edu/pdf/stata.pdf

More information

piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 September 8, 2017

piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 September 8, 2017 piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 1 Heriot-Watt University, Edinburgh, UK Center for Energy Economics Research and Policy (CEERP) 2 The Hebrew University

More information

The Stata Bible 2.0. Table of Contents. by Dawn L. Teele 1

The Stata Bible 2.0. Table of Contents. by Dawn L. Teele 1 The Stata Bible 2.0 by Dawn L. Teele 1 Welcome to what I hope is a very useful research resource for Stata programmers of all levels. The content of this tutorial has been developed while I was writing

More information

Workshop for empirical trade analysis. December 2015 Bangkok, Thailand

Workshop for empirical trade analysis. December 2015 Bangkok, Thailand Workshop for empirical trade analysis December 2015 Bangkok, Thailand Cosimo Beverelli (WTO) Rainer Lanz (WTO) Content a. Resources b. Stata windows c. Organization of the Bangkok_Dec_2015\Stata folder

More information

IN-CLASS EXERCISE: INTRODUCTION TO THE R "SURVEY" PACKAGE

IN-CLASS EXERCISE: INTRODUCTION TO THE R SURVEY PACKAGE NAVAL POSTGRADUATE SCHOOL IN-CLASS EXERCISE: INTRODUCTION TO THE R "SURVEY" PACKAGE Survey Research Methods (OA4109) Lab: Introduction to the R survey Package Goal: Introduce students to the R survey package.

More information

Panel Data 4: Fixed Effects vs Random Effects Models

Panel Data 4: Fixed Effects vs Random Effects Models Panel Data 4: Fixed Effects vs Random Effects Models Richard Williams, University of Notre Dame, http://www3.nd.edu/~rwilliam/ Last revised April 4, 2017 These notes borrow very heavily, sometimes verbatim,

More information

Introduction to Stata - Session 1

Introduction to Stata - Session 1 Introduction to Stata - Session 1 Simon, Hong based on Andrea Papini ECON 3150/4150, UiO January 15, 2018 1 / 33 Preparation Before we start Sit in teams of two Download the file auto.dta from the course

More information

Stata: A Brief Introduction Biostatistics

Stata: A Brief Introduction Biostatistics Stata: A Brief Introduction Biostatistics 140.621 2005-2006 1. Statistical Packages There are many statistical packages (Stata, SPSS, SAS, Splus, etc.) Statistical packages can be used for Analysis Data

More information

STATA November 2000 BULLETIN ApublicationtopromotecommunicationamongStatausers

STATA November 2000 BULLETIN ApublicationtopromotecommunicationamongStatausers STATA November 2000 TECHNICAL STB-58 BULLETIN ApublicationtopromotecommunicationamongStatausers Editor Associate Editors H. Joseph Newton Nicholas J. Cox, University of Durham Department of Statistics

More information

ADePT: Labor. Technical User s Guide. Version 1.0. Automated analysis of the labor market conditions in low- and middle-income countries

ADePT: Labor. Technical User s Guide. Version 1.0. Automated analysis of the labor market conditions in low- and middle-income countries Development Research Group, Development Economics, World Bank ADePT: Labor Version 1.0 Automated analysis of the labor market conditions in low- and middle-income countries Technical User s Guide The ADePT

More information

Stata Session 2. Tarjei Havnes. University of Oslo. Statistics Norway. ECON 4136, UiO, 2012

Stata Session 2. Tarjei Havnes. University of Oslo. Statistics Norway. ECON 4136, UiO, 2012 Stata Session 2 Tarjei Havnes 1 ESOP and Department of Economics University of Oslo 2 Research department Statistics Norway ECON 4136, UiO, 2012 Tarjei Havnes (University of Oslo) Stata Session 2 ECON

More information

ECONOMICS 452* -- Stata 12 Tutorial 1. Stata 12 Tutorial 1. TOPIC: Getting Started with Stata: An Introduction or Review

ECONOMICS 452* -- Stata 12 Tutorial 1. Stata 12 Tutorial 1. TOPIC: Getting Started with Stata: An Introduction or Review Stata 12 Tutorial 1 TOPIC: Getting Started with Stata: An Introduction or Review DATA: auto1.raw and auto1.txt (two text-format data files) TASKS: Stata 12 Tutorial 1 is intended to introduce you to some

More information

Empirical trade analysis

Empirical trade analysis Empirical trade analysis Introduction to Stata Cosimo Beverelli World Trade Organization Cosimo Beverelli Stata introduction Bangkok, 18-21 Dec 2017 1 / 23 Outline 1 Resources 2 How Stata looks like 3

More information

Stata version 13. First Session. January I- Launching and Exiting Stata Launching Stata Exiting Stata..

Stata version 13. First Session. January I- Launching and Exiting Stata Launching Stata Exiting Stata.. Stata version 13 January 2015 I- Launching and Exiting Stata... 1. Launching Stata... 2. Exiting Stata.. II - Toolbar, Menu bar and Windows.. 1. Toolbar Key.. 2. Menu bar Key..... 3. Windows..... III -...

More information

Introduction to data analysis using STATA. Miguel Niño-Zarazúa World Institute for Development Economics Research United Nations University

Introduction to data analysis using STATA. Miguel Niño-Zarazúa World Institute for Development Economics Research United Nations University Introduction to data analysis using STATA Miguel Niño-Zarazúa World Institute for Development Economics Research United Nations University Background STATA is powerful command driven package for statistical

More information

You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables

You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables Jennie Murack You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables How to conduct basic descriptive statistics

More information

ECON Introductory Econometrics Seminar 4

ECON Introductory Econometrics Seminar 4 ECON4150 - Introductory Econometrics Seminar 4 Stock and Watson EE8.2 April 28, 2015 Stock and Watson EE8.2 ECON4150 - Introductory Econometrics Seminar 4 April 28, 2015 1 / 20 Current Population Survey

More information

Birkbeck College Department of Economics, Mathematics and Statistics.

Birkbeck College Department of Economics, Mathematics and Statistics. Birkbeck College Department of Economics, Mathematics and Statistics. Graduate Certificates and Diplomas Economics, Finance, Financial Engineering 2012 Applied Statistics and Econometrics INTRODUCTION

More information

An Introduction to Stata Exercise 1

An Introduction to Stata Exercise 1 An Introduction to Stata Exercise 1 Anna Folke Larsen, September 2016 1 Table of Contents 1 Introduction... 1 2 Initial options... 3 3 Reading a data set from a spreadsheet... 5 4 Descriptive statistics...

More information

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT PRIMER FOR ACS OUTCOMES RESEARCH COURSE: TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT STEP 1: Install STATA statistical software. STEP 2: Read through this primer and complete the

More information

ECONOMICS 452 TIME SERIES WITH STATA

ECONOMICS 452 TIME SERIES WITH STATA 1 ECONOMICS 452 01 Introduction TIME SERIES WITH STATA This manual is intended for the first half of the Economics 452 course and introduces some of the time series capabilities in Stata 8 I will be writing

More information

International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata

International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata Paul Dickman September 2003 1 A brief introduction to Stata Starting the Stata program

More information

Introduction to STATA 6.0 ECONOMICS 626

Introduction to STATA 6.0 ECONOMICS 626 Introduction to STATA 6.0 ECONOMICS 626 Bill Evans Fall 2001 This handout gives a very brief introduction to STATA 6.0 on the Economics Department Network. In a few short years, STATA has become one of

More information

STAT10010 Introductory Statistics Lab 2

STAT10010 Introductory Statistics Lab 2 STAT10010 Introductory Statistics Lab 2 1. Aims of Lab 2 By the end of this lab you will be able to: i. Recognize the type of recorded data. ii. iii. iv. Construct summaries of recorded variables. Calculate

More information

tabulate varname [aw=weightvar]

tabulate varname [aw=weightvar] 1 Commands Introduced In this chapter you will learn these Stata basics: How to obtain information about a dataset How to obtain information about variables How to write and save a Do-file (a file that

More information

Appendix II: STATA Preliminary

Appendix II: STATA Preliminary Appendix II: STATA Preliminary STATA is a statistical software package that offers a large number of statistical and econometric estimation procedures. With STATA we can easily manage data and apply standard

More information

A Short Introduction to STATA

A Short Introduction to STATA A Short Introduction to STATA 1) Introduction: This session serves to link everyone from theoretical equations to tangible results under the amazing promise of Stata! Stata is a statistical package that

More information

Cross-Sectional Analysis

Cross-Sectional Analysis STATA 13 - SAMPLE SESSION Cross-Sectional Analysis Short Course Training Materials Designing Policy Relevant Research and Data Processing and Analysis with STATA 13 for Windows* 1st Edition Margaret Beaver

More information

Department of Economics Spring 2016 University of California Economics 154 Professor Martha Olney Stata Lesson Wednesday February 17, 2016

Department of Economics Spring 2016 University of California Economics 154 Professor Martha Olney Stata Lesson Wednesday February 17, 2016 University of Califnia Economics 154 Berkeley Profess Martha Olney Stata Lesson Wednesday February 17, 2016 [1] Where to find the data sets http://www.econ.berkeley.edu/~olney/spring16/econ154 There are

More information

3.6 Sample code: yrbs_data <- read.spss("yrbs07.sav",to.data.frame=true)

3.6 Sample code: yrbs_data <- read.spss(yrbs07.sav,to.data.frame=true) InJanuary2009,CDCproducedareportSoftwareforAnalyisofYRBSdata, describingtheuseofsas,sudaan,stata,spss,andepiinfoforanalyzingdatafrom theyouthriskbehaviorssurvey. ThisreportprovidesthesameinformationforRandthesurveypackage.Thetextof

More information

Can double click the data file and it should open STATA

Can double click the data file and it should open STATA ECO 445: International Trade Professor Jack Rossbach Instructions on Doing Gravity Regressions in STATA Important: If you don t know how to use a command, use the help command in R. For example, type help

More information

Stata versions 12 & 13 Week 4 Practice Problems

Stata versions 12 & 13 Week 4 Practice Problems Stata versions 12 & 13 Week 4 Practice Problems SOLUTIONS 1 Practice Screen Capture a Create a word document Name it using the convention lastname_lab1docx (eg bigelow_lab1docx) b Using your browser, go

More information

WORKFLOW. Effective Data Management Strategies for Doing Research Well

WORKFLOW. Effective Data Management Strategies for Doing Research Well WORKFLOW Effective Data Management Strategies for Doing Research Well WHY? Why an explicit focus on workflow? WHAT? What are the steps and tasks in an effective workflow? HOW? How can we use Stata and

More information

Further processing of estimation results: Basic programming with matrices

Further processing of estimation results: Basic programming with matrices The Stata Journal (2005) 5, Number 1, pp. 83 91 Further processing of estimation results: Basic programming with matrices Ian Watson ACIRRT, University of Sydney i.watson@econ.usyd.edu.au Abstract. Rather

More information

Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October Stata 2. Willa Friedman

Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October Stata 2. Willa Friedman Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October 2010 Stata 2 Willa Friedman Outline of Presentation Importing data from other sources IDs Merging and Appending multiple

More information

Data-Analysis Exercise Fitting and Extending the Discrete-Time Survival Analysis Model (ALDA, Chapters 11 & 12, pp )

Data-Analysis Exercise Fitting and Extending the Discrete-Time Survival Analysis Model (ALDA, Chapters 11 & 12, pp ) Applied Longitudinal Data Analysis Page 1 Data-Analysis Exercise Fitting and Extending the Discrete-Time Survival Analysis Model (ALDA, Chapters 11 & 12, pp. 357-467) Purpose of the Exercise This data-analytic

More information

Week 11: Interpretation plus

Week 11: Interpretation plus Week 11: Interpretation plus Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline A bit of a patchwork

More information

Introduction to Computing for Sociologists Neustadtl

Introduction to Computing for Sociologists Neustadtl Introduction to Computing for Sociologists Neustadtl Using Regression Regression has a lot of parts, most of it pre- and post- analysis. Do you understand your data? How are your variables measured? Are

More information

Computing Optimal Strata Bounds Using Dynamic Programming

Computing Optimal Strata Bounds Using Dynamic Programming Computing Optimal Strata Bounds Using Dynamic Programming Eric Miller Summit Consulting, LLC 7/27/2012 1 / 19 Motivation Sampling can be costly. Sample size is often chosen so that point estimates achieve

More information

Survey Questions and Methodology

Survey Questions and Methodology Survey Questions and Methodology Winter Tracking Survey 2012 Final Topline 02/22/2012 Data for January 20 February 19, 2012 Princeton Survey Research Associates International for the Pew Research Center

More information

Data analysis using Stata , AMSE Master (M1), Spring semester

Data analysis using Stata , AMSE Master (M1), Spring semester Data analysis using Stata 2016-2017, AMSE Master (M1), Spring semester Notes Marc Sangnier Data analysis using Stata Virtually infinite number of tasks for data analysis. Almost infinite number of commands

More information

Week 1: Introduction to Stata

Week 1: Introduction to Stata Week 1: Introduction to Stata Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ALL RIGHTS RESERVED 1 Outline Log

More information

Introduction to Stata

Introduction to Stata Introduction to Stata Introduction In introductory biostatistics courses, you will use the Stata software to apply statistical concepts and practice analyses. Most of the commands you will need are available

More information

A quick introduction to STATA:

A quick introduction to STATA: 1 HG Revised September 2011 A quick introduction to STATA: (by E. Bernhardsen, with additions by H. Goldstein) 1. How to access STATA from the pc s at the computer lab and elsewhere at UiO. At the computer

More information

Advanced Stata Skills

Advanced Stata Skills Advanced Stata Skills Contents Stata output in Excel & Word... 2 Copy as Table... 2 putexcel... 2 tabout (v3)... 2 estout / esttab... 2 Common Options... 2 Nice Looking Tables in Stata... 3 Descriptive

More information