Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Lecture 2
The dummies guide to STATA
Wiji Arulampalam
18/10/2006
1
Econometrics Software
You can use any software that does what you
need
See Timberlake for details of what does what
well [www.timberlake.co.uk]
PC Give is hard to beat for time series analysis
Microfit, EViews are good alternatives
WHY STATA
STATA
STATA
Use STATA: FOR
large survey datasets (merging them)
complex nonlinear models (e.g. LDVs)
But see also LimDep
nonparametric and evaluation methods
you want to
continue studying economics
be a professional economist
learn something new
Accessing STATA
Available from your Delivered Applications
Ws tata.exe
Double click on icon!
Buttons/Menu
10
Results window
11
help xxx
13
Exit, clear
14
Exit, clear
Menu/tabs
15
More
--more-- in your output window more output to come.
[Press spacebar and the next page appears]
Command set more off turn this off
17
18
20
22
23
24
25
26
27
28
29
30
31
Tabulating (1)
tab x1 x2 if x4==0, sum(x3)
gives the means of x3 for each cell of the x1 vs x2
crosstabulation for observations where x4=0
Tabulating (1)
tab x1 x2, col
Gives % of column instead of count
Can get row percentages by using row instead
Or both by using row col
33
Labelling
Always have your data comprehensively labelled
.label data This is pooled GHS 90-99
.label variable reg region
.lab define reglab 0 North 1 South 2 Middle
.lab values region reglab
(squares)
. gen region1=(region==1)
(1 if true, 0 if not)
. replace rate=rate/100
. replace age=25 if age==250
. egen meaninc=mean(income), by (region)
(see help egen for details)
36
37
39
40
Functions
Lots of functions are possible.
See . help functions
Obvious ones like
Log(), abs(), int(), round(), sqrt(), min(), max(), sum()
String functions
Converting strings to numbers and vice versa
Date functions
Converting dates to numbers and vice versa
Command files
Stata command files have a .do extension
It is ALWAYS good practice to use a .do file
you will know exactly what you have done.
It makes it easy to develop ideas.
And correct mistakes.
. do wages.do, nostop
(echoes to screen, and keeps going after error
encountered)
Or . run wages.do
(executes silently)
42
44
Next Lecture
Monday 23rd October F107 11:00-12:00
STATA demo
45