Advanced Stata Skills

Size: px
Start display at page:

Download "Advanced Stata Skills"

Transcription

1 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 Statistics... 3 Table of Statistics... 3 Less Good Alternatives... 4 Formatting Regression Output... 5 Storing Results... 5 estimates... 5 estout... 5 outreg Common Options... 5 Margins... 6 Running the Regression... 6 Predictions... 6 Plots... 6 Unspecified Variables... 7 Specifying Values... 7 Matrix Operations... 8 Basic Operations... 8 Example: Regression Output... 8 Example: Multiple T-Tests... 8 Macro Variables & Loops... 9 Example: Appending many files... 9 Example: Identifying variables in file... 10

2 Stata output in Excel & Word In excel, the functions can overwrite the cells you have if you use the new XLS[X] functions (only in tabout v3 available on the website only). You can set up a table how you want referencing those cells. Note that tabout puts in numbers as text, so if you need to do additional formatting, you have to change back to number (e.g., numbervalue()) Copy as Table With output selected, right click and choose Copy Table. This does not have any special powers to split output into a table, it simply looks for vertical and horizontal breaks. It is usually best to copy tables to Excel before copying to word as needed. putexcel (built-in command) don t forget to set a working directory first so that it goes in the right spot. Must always specify the exact cell (or upper left cell) to put things tabout (v3) Typically the best option for tables. can change style to docx (and file extension) to go straight to word. To install the vry latest version (e.g., v3): Run this to determine which directory to put your ado files: adopath Go to tabout s webpage and download the program file for your version of Stata. Save the file with the extension.ado in the directory listed as PERSONAL above which tabout To install v2, or once v3 becomes the official version (not as of ) ssc install tabout estout / esttab ssc install estout after installing, see help estout Very versatile, so basic things can sometimes be difficult. Common Options specify option: append/modify or replace specify option location(1 2) (row 1, col 2/B) specify opction c : freq

3 Nice Looking Tables in Stata Descriptive Statistics sysuse auto, clear command varlist qualifiers using file, options ssc install tabout Frequency Tables Original tab1 rep78 foreign Tabulate Summarize Original tab foreign, sum(mpg) tabout rep78 foreign using xttab1, c(freq col cum) style(docx) clab(freq. Percent Cum.) replace tabout foreign using xttabsum, sum c(mean mpg sd mpg N mpg) clab(x sd n) style(docx) replace Pivot Table (1 var) Original tab rep78 foreign, sum(mpg) nost nofreq 2-way Table Original tab rep78 foreign, col Table of Statistics tabout rep78 foreign using xtpivot, sum c(mean mpg) clab(x) style(xlsx) tabout rep78 foreign using xttab2.xlsx, c(freq col) style(xlsx) // statistics are side-by-side, not vertical ssc install estout Summarize Original tabstat price mpg rep78, by(foreign) statistics(mean sd) columns(statistics) estpost tabstat price mpg rep78, by(foreign) statistics(mean sd) columns(statistics) listwise esttab. using tabstat_1.rtf, cells("mean(fmt(a3)) sd") Original summarize price mpg rep78 Correlation estpost summarize price mpg rep78 esttab. using sum1.tab, cells("mean sd count") noobs tab label replace Original pwcorr price mpg turn foreign, star(.05) T-test Original ttest price, by(foreign) estpost correlate price mpg turn foreign, matrix esttab. using corr1.tab, not unstack compress noobs tab replace label p estpost ttest price mpg headroom trunk, by(foreign) // can do multiple at the same time esttab., wide

4 Less Good Alternatives Pivot table (2+ statistics) 2-way Table Correlation Table of Statistics Stata option, but no good alt alt alt table foreign rep78, c(mean mpg sd mpg N mpg) cap erase xtpivot2.tab levelsof foreign, local(levels) foreach t of local levels { tabout rep78 if foreign == `t' using xtpivot2.tab, h1(miles per Gallon) sum c(mean mpg sd mpg N mpg) clab(x sd n) style(tab) append } estpost tabulate rep78 foreign esttab. using xttab2.tab, c(b colpct) tab replace unstack nonumber noobs nomtitle collabels(none) * Does not display labels for summary statistic or variable label for either variable net install makematrix makematrix mycorrs, from(r(rho)) cols(mpg) format(%9.2f): pwcorr price mpg turn foreign putexcel set corr3 putexcel A1 = matrix(mycorrs), names * cols(mpg) allows to limit to the correlates of one variable estpost tabstat price mpg rep78, by(foreign) statistics(mean sd) columns(variables) listwise matrix(transpose) esttab. using tabstat_2.rtf, main(mean) aux(sd) nostar unstack noobs nonote label Summarize alt tabstat with the save option and putexcel

5 Formatting Regression Output For unformatted statistics, see Matrix Operations Storing Results After you run each regression model, run estimates store with a brief label for that model. Giving the same name with update/overwrite the results. You can then specify specific models to include or use all saved models with * (can sometimes leave blank). etc. estimates clear (or just be careful with names) reg estimates store full reg estimates store partial estimates Built-in to stata estimates table * estout If you want to store the results using a prefix command (so it is all on one linne, use eststo full: reg rtf does the best because the special characters (brackets, parenthese, get lost when opening other formats in Excel. esttab * using output.rtf, ci(2) noconstant wide label nonumbers b(%6.2f) noisily esttab * using output.rtf, cells(`" b(fmt(a2) star) ci(par("[ " " - " " ]"))" ) noconstant wide label nonumbers b(%6.2f) esttab using output.rtf, wide label nonumbers b(%6.2f) outreg2 outreg2 has been around longer (previously outreg), so it tends to be more popular. However, estout is often more flexible. It can can be implemented very similarly. after installing, see help outreg2 ssc install outreg2 example: outreg2 [*] using outtest, word eform label bdec(2) sideway stats(coef ci) ci bracket(ci) nocons Common Options eform specifies to use the coefficient as displaed (e.g., odds-ratios if odds-ratios), so it is important for logistic regression. replace specifies to overwrite the file if it already exists, usually good so you can replicate.

6 Margins From your regression results, you should be able to calculate the predicted value of the DV for different values of each IV. But, Stata can also do this for you. For logistic regression, Stata even converts the predictions to actual probabilities so they are much easier to understand. Running the Regression When running the regression, be sure to use factor variables (i. and c.) as necessary, or margins will not treat the variables properly. Assumes all variables are continuous except when using the interaction symbol (assumes factor). You can ask for margins for the interaction, just express it the same way female#black (without the factor variable indications or the individual effects, unless you want them too. regress price mpg turn i.foreign logistic foreign price mpg turn logistic score i.class example class -> 0 = no class, 1 = took class logit price mpg Predictions Average Adjusted Predictions AAP. See Default. Predictions are made for the specific cases in yourdataset, whatever the values may be. margins foreign, at( turn = 40 mpg = ( ) ) over(rep78) atmeans with multiple IVs, this can be combined with at() and other specifying Plots marginsplot accepts all the other normal graphing commands. See graph twoway marginsplot, x(read)

7 Type Command Explanation When to use Unspecified Variables both margins Stata uses the cases you have, acting as if each case has the values you specify and their original values on all other variables. But, because it doesn t change any other values, if the categories are related to the values of other variables, it is weird (you are acting as if a female was a male). both margins, atmeans Predicts with categorical dummy codes at the observed proportion, and neither 0 nor 1. e.g.,.70 (for when 70% of the cases have a 1) instead of 0 or 1. Predicts with numeric variables at theiir mean value. This can be useful because you can state exactly what value of each variable the predictions were calculated for. categorical margins, asbalanced Assumes all categories in the factor variables are eqully likely (e.g., the groups are equal size/proportions). Adjusts the predictions as if your dataset had equal. Specifying Values categorical margins class Predicts for each level of class Default To account for different likelihood of group memberships. If a case with all the values at the mean is a reasonable representation of a typical case. To correct for category inbalance in your data, which is equal in the population.. both margins, at( class = ( 0 1 ) ) Predicts for the specified levels of class. To predict for only certain values. margins, at( mpg = ( ) ) margins, at( mpg = (20(01)40) ) (these are identical) Using the dataset as is, calculates the average DV if each observation had the specified values. categorical margins, over(class) Tweaks the default method of setting values for unspecified variables. Uses only cases with each particular value of over. both margins, dydx(class) Calculates the marginal effect (partial effect) for that variable. For a linear regression this is the same as the coefficient. margins, dydx(mpg) If members of each group do differ on other characteristics. To get logistic regression dummy coefficients as probabilities. For logistic regression to report one number.

8 Matrix Operations Basic Operations matrix name = expression matrix a = (1\ 2\ 3) // creates one column matrix b = (1, 2, 3) // creates one row matrix c = (1,2\3,4\5,6) // creates a 2 column, 3 row matrix matrix list c // print the matrix matrix d = c // transpose c to make a 3 column, 2 row matrix matrix e = c[2..3,.] // extract the 2nd and 3rd row of c (3,4\5,6) matrix f = J(2,3,.) // create a 2 row, 3 column matrix with all missing values matrix g = ( nullmat(g) \ 2 ) // nullmat() create matrix g if doesn t exist, useful for loops matrix f = g \ J(2,2,.) // add 2 blank rows to the 3x2 matrix xxx Example: Regression Output regress price mpg headroom trunk matrix reg = r(table)' putexcel set "regtable.xlsx", modify putexcel A1=matrix(reg), names Example: Multiple T-Tests cap matrix drop ps foreach i in { qui ttest pwfa if periods == `i', by( wfa841_12mo ) matrix ps = ( nullmat(ps) \ `r(p)', `i' ) } // end foreach matrix list ps, format(%5.4f) putexcel set mytable putexcel A1 = matrix(ps), names putexcel B1 = (e(n)) C1 = ( Obs )

9 Macro Variables & Loops Stata Syntax: Loops for Appending CSV Files see also: help extended_fcn Assumes files are in the subfolder csv Local variables are marked by a backtick (`) and a single quote ( ): `var' Example: Appending many files /****** ALL-IN-ONE ******/ cd "C:\myfolder" clear /**** STEP-BY-STEP *****/ cd "C:\myfolder" mkdir "stata" clear local csvfiles: dir "csv" files "*.csv" foreach file of local csvfiles { preserve insheet using csv/`file', clear ** add syntax here to run on each file** save temp, replace restore append using temp } rm temp // remove temporary.dta file save alldata, replace local csvfiles : dir "csv" files "*.csv" foreach file of local csvfiles { insheet using csv/`file', clear local name : subinstr local file ".csv" "" gen file = `name' // optional ** add syntax here to run on each file ** save stata/`name'.dta, replace } cd "stata" local statafiles : dir. files "*.dta" append using `statafiles' cd.. save alldata, replace

10 Example: Identifying variables in file If you only want a specific list of variables, that some files do not have. * Remember that local only lasts through the run you are doing. * YOU CANNOT RUN ONE LINE AT A TIME How to get a list of only those variables shared by two lists: local want id1 id2 id3 id4 id5 di "`want'" unab have: _all di "`have'" local tokeep: list want & have di "`tokeep " keep `tokeep Example also shows when the datafiles are in multiple directories. cd "C:\myfolder" clear local want id1 id2 id3 id4 id5 local dirs: dir "Countries" dirs "*" foreach dir of local dirs { local files: dir "`dir " files "*.dta" foreach file of local files { preserve use Countries/`dir /`file', clear ** add syntax here to run on each file** unab have: _all local tokeep: list want & have keep `tokeep } } save temp, replace restore append using temp rm temp // remove temporary.dta file save alldata, replace

0.1 Stata Program 50 /********-*********-*********-*********-*********-*********-*********/ 31 /* Obtain Data - Populate Source Folder */

0.1 Stata Program 50 /********-*********-*********-*********-*********-*********-*********/ 31 /* Obtain Data - Populate Source Folder */ 0.1 Stata Program 1 capture log close master // suppress error and close any open logs 2 log using RDC3-master, name(master) replace text 3 // program: RDC3-master.do 4 // task: Demonstrate basic Stata

More information

Research Support. Processing Results in Stata

Research Support. Processing Results in Stata Most Stata functions (such as reg) display their results in the Stata results window. Sometimes this is not quite sufficient: we might want to either preserve some of the output and use it in future computations,

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

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

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

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

Intro to Stata for Political Scientists

Intro to Stata for Political Scientists Intro to Stata for Political Scientists Andrew S. Rosenberg Junior PRISM Fellow Department of Political Science Workshop Description This is an Introduction to Stata I will assume little/no prior knowledge

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

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

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

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

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

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

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

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

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

Stata Training. AGRODEP Technical Note 08. April Manuel Barron and Pia Basurto

Stata Training. AGRODEP Technical Note 08. April Manuel Barron and Pia Basurto AGRODEP Technical Note 08 April 2013 Stata Training Manuel Barron and Pia Basurto AGRODEP Technical Notes are designed to document state-of-the-art tools and methods. They are circulated in order to help

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

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

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

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

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

STATA 13 INTRODUCTION

STATA 13 INTRODUCTION STATA 13 INTRODUCTION Catherine McGowan & Elaine Williamson LONDON SCHOOL OF HYGIENE & TROPICAL MEDICINE DECEMBER 2013 0 CONTENTS INTRODUCTION... 1 Versions of STATA... 1 OPENING STATA... 1 THE STATA

More information

StatLab Workshops 2008

StatLab Workshops 2008 Stata Workshop Fall 2008 Adrian de la Garza and Nancy Hite Using STATA at the Statlab 1. The Different Windows in STATA Automatically displayed windows o Command Window: executes STATA commands; type in

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

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

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

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

1 Introducing Stata sample session

1 Introducing Stata sample session 1 Introducing Stata sample session Introducing Stata This chapter will run through a sample work session, introducing you to a few of the basic tasks that can be done in Stata, such as opening a dataset,

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

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1 Intermediate Stata Jeremy Craig Green 1 March 2011 3/29/2011 1 Advantages of Stata Ubiquitous in economics and political science Gaining popularity in health sciences Large library of add-on modules Version

More information

Lecture 4: Programming

Lecture 4: Programming Introduction to Stata- A. chevalier Content of Lecture 4: -looping (while, foreach) -branching (if/else) -Example: the bootstrap - saving results Lecture 4: Programming 1 A] Looping First, make sure you

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

Community Resource: Egenmore, by command, return lists, and system variables. Beksahn Jang Feb 22 nd, 2016 SOC561

Community Resource: Egenmore, by command, return lists, and system variables. Beksahn Jang Feb 22 nd, 2016 SOC561 Community Resource: Egenmore, by command, return lists, and system variables. Beksahn Jang Feb 22 nd, 2016 SOC561 Egenmore Egenmore is a package in Stata that extends the capabilities of the egen command.

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

Introduction to STATA

Introduction to STATA Center for Teaching, Research and Learning Research Support Group American University, Washington, D.C. Hurst Hall 203 rsg@american.edu (202) 885-3862 Introduction to STATA WORKSHOP OBJECTIVE: This workshop

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

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

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 version 14 Also works for versions 13 & 12. Lab Session 1 February Preliminary: How to Screen Capture..

Stata version 14 Also works for versions 13 & 12. Lab Session 1 February Preliminary: How to Screen Capture.. Stata version 14 Also works for versions 13 & 12 Lab Session 1 February 2016 1. Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. 3. Preliminary: How to Save

More information

Getting Started Using Stata

Getting Started Using Stata Categorical Data Analysis Getting Started Using Stata Scott Long and Shawna Rohrman cda12 StataGettingStarted 2012 05 11.docx Getting Started in Stata Opening Stata When you open Stata, the screen has

More information

INTRODUCTION to. Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010

INTRODUCTION to. Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010 INTRODUCTION to Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010 While we are waiting Everyone who wishes to work along with the presentation should log onto

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

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 2

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 2 texdoc 20 An update on creating LaTeX documents from within Stata Contents Example 2 Ben Jann University of Bern, benjann@sozunibech 2016 German Stata Users Group Meeting GESIS, Cologne, June 10, 2016

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

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

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

ECO375 Tutorial 1 Introduction to Stata

ECO375 Tutorial 1 Introduction to Stata ECO375 Tutorial 1 Introduction to Stata Matt Tudball University of Toronto Mississauga September 14, 2017 Matt Tudball (University of Toronto) ECO375H5 September 14, 2017 1 / 25 What Is Stata? Stata is

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

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

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

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

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

Getting Started Using Stata

Getting Started Using Stata Quant II 2011: Categorical Data Analysis Getting Started Using Stata Shawna Rohrman 2010 05 09 Revised by Trisha Tiamzon 2010 12 26 Note: Parts of this guide were adapted from Stata s Getting Started with

More information

A Practical Introduction to Stata

A Practical Introduction to Stata A Practical Introduction to Stata Mark E. McGovern Harvard Center for Population and Development Studies Geary Institute and School of Economics, University College Dublin August 2012 Abstract This document

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

Getting Our Feet Wet with Stata SESSION TWO Fall, 2018

Getting Our Feet Wet with Stata SESSION TWO Fall, 2018 Getting Our Feet Wet with Stata SESSION TWO Fall, 2018 Instructor: Cathy Zimmer 962-0516, cathy_zimmer@unc.edu 1) REMINDER BRING FLASH DRIVES! 2) QUESTIONS ON EXERCISES? 3) WHAT IS Stata SYNTAX? a) A set

More information

Creating LaTeX and HTML documents from within Stata using texdoc and webdoc. Example 2

Creating LaTeX and HTML documents from within Stata using texdoc and webdoc. Example 2 Creating LaTeX and HTML documents from within Stata using texdoc and webdoc Contents Example 2 Ben Jann University of Bern, benjann@sozunibech Nordic and Baltic Stata Users Group meeting Oslo, September

More information

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 1

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 1 texdoc 2.0 An update on creating LaTeX documents from within Stata Contents Example 1 Ben Jann University of Bern, ben.jann@soz.unibe.ch UK Stata Users Group meeting London, September 89, 2016 1 The texdoc

More information

Subject index. ASCII data, reading comma-separated fixed column multiple lines per observation

Subject index. ASCII data, reading comma-separated fixed column multiple lines per observation Subject index Symbols %fmt... 106 110 * abbreviation character... 374 377 * comment indicator...346 + combining strings... 124 125 - abbreviation character... 374 377.,.a,.b,...,.z missing values.. 130

More information

Sustainability of Public Policy Lecture 1 Introduc6on STATA. Rossella Iraci Capuccinello

Sustainability of Public Policy Lecture 1 Introduc6on STATA. Rossella Iraci Capuccinello Sustainability of Public Policy Lecture 1 Introduc6on STATA Rossella Iraci Capuccinello Ge=ng started in STATA! Start STATA " Simply click on icon " Stata should look like this: BuDons/menu Review window

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

Kim Mannemar Sønderskov. Stata. A practical introduction. Hans Reitzels Forlag

Kim Mannemar Sønderskov. Stata. A practical introduction. Hans Reitzels Forlag Stata Kim Mannemar Sønderskov Stata A practical introduction Hans Reitzels Forlag Stata: A practical introduction Edition 1, print run 1 The authors and Hans Reitzel Publishers, 2015 Publishing editor:

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

SAS Training Spring 2006

SAS Training Spring 2006 SAS Training Spring 2006 Coxe/Maner/Aiken Introduction to SAS: This is what SAS looks like when you first open it: There is a Log window on top; this will let you know what SAS is doing and if SAS encountered

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

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

Important Things to Know about Stata

Important Things to Know about Stata Important Things to Know about Stata Accessing Stata Stata 14.0 is available in all clusters and classrooms on campus. You may also purchase it at a substantial discount through Notre Dame s GradPlan.

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

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

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 1

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 1 texdoc 2.0 An update on creating LaTeX documents from within Stata Contents Example 1 Ben Jann University of Bern, ben.jann@soz.unibe.ch 2016 German Stata Users Group Meeting GESIS, Cologne, June 10, 2016

More information

StatCalc User Manual. Version 9 for Mac and Windows. Copyright 2018, AcaStat Software. All rights Reserved.

StatCalc User Manual. Version 9 for Mac and Windows. Copyright 2018, AcaStat Software. All rights Reserved. StatCalc User Manual Version 9 for Mac and Windows Copyright 2018, AcaStat Software. All rights Reserved. http://www.acastat.com Table of Contents Introduction... 4 Getting Help... 4 Uninstalling StatCalc...

More information

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

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 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

More information

Introduction to SAS. I. Understanding the basics In this section, we introduce a few basic but very helpful commands.

Introduction to SAS. I. Understanding the basics In this section, we introduce a few basic but very helpful commands. Center for Teaching, Research and Learning Research Support Group American University, Washington, D.C. Hurst Hall 203 rsg@american.edu (202) 885-3862 Introduction to SAS Workshop Objective This workshop

More information

A Short Guide to Stata 14

A Short Guide to Stata 14 Short Guides to Microeconometrics Fall 2016 Prof. Dr. Kurt Schmidheiny Universität Basel A Short Guide to Stata 14 1 Introduction 2 2 The Stata Environment 2 3 Where to get help 3 4 Additions to Stata

More information

From datasets to resultssets in Stata

From datasets to resultssets in Stata From datasets to resultssets in Stata Roger Newson King s College London, London, UK roger.newson@kcl.ac.uk http://www.kcl-phs.org.uk/rogernewson/ Distributed at the 10th UK Stata Users Group Meeting on

More information

Lecture 2: Advanced data manipulation

Lecture 2: Advanced data manipulation Introduction to Stata- A. Chevalier Content of Lecture 2: Lecture 2: Advanced data manipulation -creating data -using dates -merging and appending datasets - wide and long -collapse 1 A] Creating data

More information

SAS Training BASE SAS CONCEPTS BASE SAS:

SAS Training BASE SAS CONCEPTS BASE SAS: SAS Training BASE SAS CONCEPTS BASE SAS: Dataset concept and creating a dataset from internal data Capturing data from external files (txt, CSV and tab) Capturing Non-Standard data (date, time and amounts)

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

Advanced Regression Analysis Autumn Stata 6.0 For Dummies

Advanced Regression Analysis Autumn Stata 6.0 For Dummies Advanced Regression Analysis Autumn 2000 Stata 6.0 For Dummies Stata 6.0 is the statistical software package we ll be using for much of this course. Stata has a number of advantages over other currently

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

Lab #3. Viewing Data in SAS. Tables in SAS. 171:161: Introduction to Biostatistics Breheny

Lab #3. Viewing Data in SAS. Tables in SAS. 171:161: Introduction to Biostatistics Breheny 171:161: Introduction to Biostatistics Breheny Lab #3 The focus of this lab will be on using SAS and R to provide you with summary statistics of different variables with a data set. We will look at both

More information

The -biplot- command and software development at StataCorp.

The -biplot- command and software development at StataCorp. Outline The -biplot- command and software development at StataCorp. June 26, 2009 1 Properties Mathematical Background 2 Biplot now Forthcomming biplot 3 Outline Properties Mathematical Background 1 Properties

More information

Using PROC SQL to Generate Shift Tables More Efficiently

Using PROC SQL to Generate Shift Tables More Efficiently ABSTRACT SESUG Paper 218-2018 Using PROC SQL to Generate Shift Tables More Efficiently Jenna Cody, IQVIA Shift tables display the change in the frequency of subjects across specified categories from baseline

More information

Chapter 2 Assignment (due Thursday, April 19)

Chapter 2 Assignment (due Thursday, April 19) (due Thursday, April 19) Introduction: The purpose of this assignment is to analyze data sets by creating histograms and scatterplots. You will use the STATDISK program for both. Therefore, you should

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

Speaking Stata: Problems with tables, Part II

Speaking Stata: Problems with tables, Part II The Stata Journal (2003) 3, Number 4, pp. 420 439 Speaking Stata: Problems with tables, Part II Nicholas J. Cox University of Durham, UK n.j.cox@durham.ac.uk Abstract. Three user-written commands are reviewed

More information

Creating summary tables using the sumtable command

Creating summary tables using the sumtable command Creating summary tables using the sumtable command Lauren Scott and Chris Rogers University of Bristol Clinical Trials and Evaluation Unit 2016 London Stata Users Group meeting Scott LJ, Rogers CA. Creating

More information

Getting started with Stata 13

Getting started with Stata 13 Getting started with Stata 13 August 2015 - Version 3.1 Evelyn Ersanilli Table of Contents Opening Stata... 3 File types... 4 Log-files... 4 Do-files... 5 Ado-files... 7 Opening and saving data... 7 Stata

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

Stata version 12. Lab Session 1 February Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session..

Stata version 12. Lab Session 1 February Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. Stata version 12 Lab Session 1 February 2013 1. Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. 3. Preliminary: How to Save a Stata Graph... 4. Enter Data:

More information

Quick look at the margins command

Quick look at the margins command Quick look at the margins command Jean-Philippe Gauvin jean-philippe.gauvin@umontreal.ca October 9, 22 Abstract In this document I try to give an overview of the margins command in Stata. I start with

More information

An Introduction to Stata

An Introduction to Stata An Introduction to Stata Instructions Statistics 111 - Probability and Statistical Inference Jul 3, 2013 Lab Objective To become familiar with the software package Stata. Lab Procedures Stata gives us

More information

Creating a data file and entering data

Creating a data file and entering data 4 Creating a data file and entering data There are a number of stages in the process of setting up a data file and analysing the data. The flow chart shown on the next page outlines the main steps that

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

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

Lab #3: Probability, Simulations, Distributions:

Lab #3: Probability, Simulations, Distributions: Lab #3: Probability, Simulations, Distributions: A. Objectives: 1. Reading from an external file 2. Create contingency table 3. Simulate a probability distribution 4. The Uniform Distribution Reading from

More information

ST Lab 1 - The basics of SAS

ST Lab 1 - The basics of SAS ST 512 - Lab 1 - The basics of SAS What is SAS? SAS is a programming language based in C. For the most part SAS works in procedures called proc s. For instance, to do a correlation analysis there is proc

More information

STM103 Spring 2008 INTRODUCTION TO STATA 8.0

STM103 Spring 2008 INTRODUCTION TO STATA 8.0 STM103 Spring 2008 INTRODUCTION TO STATA 8.0 1. PREPARING BEFORE ENTERING THE LAB... 2 Getting the shared dataset... 2 Assignment 1 preparation... 2 2. STARTING A STATA SESSION... 3 Opening, Saving, and

More information