Transcript STATAintro
DataServices
NYU
Overview of STATA
Interface
Getting Started
Managing Data
Descriptive Statistics
Basic Analysis
Additional Resources
NYUDataServices
STATA is a statistical package that allows
advanced data analysis, management,
and graphics.
You can choose a perpetual license or an
annual one.
Available for Windows and Mac.
NYUDataServices
Command window:
NYUDataServices
Data window activated using br command
NYUDataServices
Do File syntax equivalent in SPSS and R
Commands should be written and saved in Do files rather
then entered directly into the command window
Some advantages to using Do files:
o allows reusing commands (the same analysis can be quickly
repeated on different data sets as long as the variables name
match)
o allows to copy, past and edit commands
o easier to read complex expressions
o allows sharing commands / methods with other researchers
NYUDataServices
Working Directories
o To CHECK the current directory:
pwd
o To CHANGE the directory:
cd
o To VIEW files in the directory:
dir
NYUDataServices
Creating / Opening datasets:
To create a new dataset:
clear
input var1 var2 var3
01 02 03 04
05 06 07 08
09 10 11 12
end
NYUDataServices
To read a Stata dataset:
use dataset name
To read non-stata formats:
.csv: insheet using “datasetname.csv”
.dat .xls: infile using “datasetname.xls”
To read a non-Stata format where first row is the
variables’ name:
import excel ”datasetname.xls", sheet(”sheet 1") firstrow
clear
To save a Stata dataset:
save dataset name, replace
outsheet using dataname.csv, comma replace
NYUDataServices
Creating and managing new variables
To create a new variable
egen variable name
To delete one
drop variable name
To recode a variable
recode
replace
NYUDataServices
For a summary:
sum variable name
sum variable name, detail
For a cross tabulation
tabulate var1 var2, chi2
For frequencies
tabulate oneway variable name
NYUDataServices
Histogram:
histogram
Scatter Plot
dotplot
Box Plot
graph box
NYUDataServices
Some examples:
pwcorr // pairwise correlation coefficients
ttest
// Mean Comparison Test
regress // OLS regression
anova // Analysis of Variance
logit
// Logistic Regression
ologit // Ordererd Logistic Regression
sem // Build a Structural Equation Model
NYUDataServices
help
NYUDataServices
http://nyu.libguides.com/content.php?pid=
38898&sid=1554472
NYUDataServices
Please follow the link below:
This will only take a few minutes and help us
a great lot in improving the tutorial
http://tinyurl.com/IntroToStata
NYUDataServices