STATA - Importing Data

of 53 /53
STATA: Data Analysis Software www.STATA.org.uk Step-by Step Screenshot Guides to help you use STATA Not affiliated with Stata Corp. STATA Importing Data

Transcript of STATA - Importing Data

Page 1: STATA - Importing Data

STATA: Data Analysis Software

www.STATA.org.uk

Step-by Step Screenshot Guides

to help you use STATA

Not affiliated with Stata Corp.

STATAImporting Data

Page 2: STATA - Importing Data

Datasets Used in Tutorial

– Datasets in these tutorials are based on examples in:

Stock and Watson (2006)

“Introduction to Econometrics”

– You can obtain all of the datasets used in these tutorials

by downloading a STATA command file from

http://www.stata.org.uk/download-examples.html

Page 3: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 4: STATA - Importing Data
Page 5: STATA - Importing Data
Page 6: STATA - Importing Data
Page 7: STATA - Importing Data
Page 8: STATA - Importing Data
Page 9: STATA - Importing Data
Page 10: STATA - Importing Data
Page 11: STATA - Importing Data
Page 12: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 13: STATA - Importing Data
Page 14: STATA - Importing Data
Page 15: STATA - Importing Data
Page 16: STATA - Importing Data
Page 17: STATA - Importing Data
Page 18: STATA - Importing Data
Page 19: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 20: STATA - Importing Data
Page 21: STATA - Importing Data
Page 22: STATA - Importing Data
Page 23: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 24: STATA - Importing Data
Page 25: STATA - Importing Data
Page 26: STATA - Importing Data
Page 27: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 28: STATA - Importing Data
Page 29: STATA - Importing Data
Page 30: STATA - Importing Data
Page 31: STATA - Importing Data
Page 32: STATA - Importing Data
Page 33: STATA - Importing Data
Page 34: STATA - Importing Data
Page 35: STATA - Importing Data
Page 36: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 37: STATA - Importing Data

Other Useful Commands

– To find help on any other command just type

help commandname

– Other useful data management commands

– replace change contents of variable

– drop remove specified variables

– keep drop other variables except specified

– merge add variables from other dataset

– append add observations from other dataset

Page 38: STATA - Importing Data
Page 39: STATA - Importing Data
Page 40: STATA - Importing Data

Outline

– Data Importing and Editing

• Import Comma-Separated Value (CSV) Files

• Generate New Variables

• Save Dataset

• Close and Re-open Dataset

• Create a do-file

• Use the Help System

• Challenge

Page 41: STATA - Importing Data

Data Importing and Editing: Challenge

Challenge

– Create a dummy variable for English Learners

Method

– Import caschool.csv

– Generate new variable (HiEl=1 if el_pct>20)

– Save dataset

– Create a do-file and copy commands

Page 42: STATA - Importing Data
Page 43: STATA - Importing Data
Page 44: STATA - Importing Data
Page 45: STATA - Importing Data
Page 46: STATA - Importing Data
Page 47: STATA - Importing Data
Page 48: STATA - Importing Data
Page 49: STATA - Importing Data
Page 50: STATA - Importing Data
Page 51: STATA - Importing Data
Page 52: STATA - Importing Data
Page 53: STATA - Importing Data

www.STATA.org.uk

– If you visit www.STATA.org.uk you can download

tutorials on these other topics:

Data Management Statistical Analysis

Importing Data Summary Statistics

Graphs Linear Regressions

Presenting Output Panel Regressions

Merge or Drop Data Time Series Analysis

Instrumental Variables

Probit Analysis