Download presentation
Presentation is loading. Please wait.
Published byCamron Charles Modified over 9 years ago
1
API-208: Stata Review Session Daniel Yew Mao Lim Harvard University Spring 2013
2
Roadmap Importing Data Data analysis Data management Programming Getting Started
3
Getting Started: Orientation COMMAND WINDOW: commands typed here VARIABLES WINDOW: variable list shown here RESULTS WINDOW: results and commands displayed here REVIEW WINDOW: past commands appear here
4
Getting Started: Syntax
5
Getting Started: Syntax Example
7
Getting Started: Useful Commands I if in by sum help ssc install
8
Getting Started: Useful Commands II Arithmetic Operators “ + ” addition “ - ” subtraction “ * ” multiplication “ / ” division “ ^ ” power
9
Getting Started: Useful Commands III Relational Operators “ > ” Greater than “ < ” Less than “ >= ” Equal or greater than “ <= ” Equal or less than “ == ” Equal to “ ~= ” Not equal to “ != ” Not equal to
10
Getting Started: Useful Commands IV Logical (Boolean) Operators “ & ” = and – Example: A & B “ | ” = or – Example: A | B A AB B
11
Getting Started: Example
12
Getting Started: Worked Example Average share of ADB loans during first and second years on UNSC Between 1985 and 2004 Average share of ADB loans during first and second years on UNSC Between 1985 and 2004 Average share of ADB loans during first and second years on UNSC Between 1985 and 2004, for each country Average share of ADB loans during first and second years on UNSC Between 1985 and 2004, for each country
13
Getting Started: Creating Do-files Text file containing all commands relevant to analysis Useful for batch processing
14
Getting Started: Creating Do-files
15
Getting Started: Commenting in Do-files * * Ignore stuff written on this line /* Text Here*/ Ignore stuff written in between
16
Getting Started: Commenting in Do-files
17
Importing Data: Data Types Stata Data.xls.csv
18
Data Management: Data Structure Cross- sectional Time-series Panel
19
Data Management: Datasets merge : add variables across datasets. append : add observations across datasets. reshape : convert data from wide/long or long/wide rename : change the name of a variable. drop : eliminate variables or observations. keep : keep variables or observations. sort : arrange into ascending order.
20
Data Management: Missing Data Recode List-wise deletion Multiple Imputation
21
Data Management: Outliers Impossible values Extreme values Logarithmic function
22
Data Management: Modifying Data generate : create new variable. replace : replace old values. recode : change values by conditions. label define : defines value labels (or “dictionary”). label values : attaches value labels (or “dictionary”) to a variable.
23
Data Analysis: Exploring Data summarize : descriptive statistics. codebook : display contents of variables. describe : display properties of variables. count : counts cases. list : show values.
24
Data Analysis: Analyzing Data tabstat : tables with statistics. tabulate : one- or two-way frequency tables (related: tab1 and tab2 ). table : calculates and displays tables of statistics.
25
Data Analysis: Worked Example Exercise 1: Create an aidsize variable with three categories based on the amount of ADB loans received (adbconstant): small (0 to 99), medium (100 to 999), and large (1000 or more). Include labels.
26
Data Analysis: MLE regress : standard OLS. Probit/logit : binary dependent variable. oprobit : ordered probit regression. ologit : ordered logistic regression. xtreg : fixed, between, and random effects, and population averaged linear models. xtregar : fixed and random effects models with AR(1) disturbance.
27
Data Analysis: Matching psmatch2 : propensity score matching. cem : coarsened exact matching.
28
Data Analysis: Interpreting Coefficients
29
Programming
30
Conclusion Pattern recognition Self-learning Programming
31
Q&A Thank you!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.