INTRODUCTION TO STATA - BERT MILLA
Transcript of INTRODUCTION TO STATA - BERT MILLA
INTRODUCTION TO STATA
NORBERTO E. MILLADepartment of StatisticsVisayas State University
Statistical Packages for Social Sciences (SPSS)
Statistical Analysis Software (SAS)
Stata
Minitab
Statgraphics
Systat
R
Python
general-purpose statistical program with uniquefeatures not found in other packages
takes a simpler approach to statistical analyseswith a single program interface.
technical help, updates, and upgrades are possibleonline
manuals/guides (pdf documentatation) comes withStata installation
available on the three (3) major operatingsystems:
Windows, Macintosh, and Unix
comes in four flavors:
Stata/MP, Stata/SE, Stata/IC, and Small Stata
RESULTS window
VARIABLES
window
COMMAND window
PROPERTIES
window
REVIEW
window
Data files: rows (variables) and columns (observations) of information; have the .dta file extension
Do files: contain set of commands which can be executed together; have the .do file extension
(.ado files contain codes of new Stata commands)
Log files: contain a record of all commands issued and the corresponding output in the Results window (except graphs); have the .smcl (default) or .log file extension
Numeric-purely numbers; black in color
String-contains numbers and/or letters; red incolor
Value labels-internally these are numbers but canbe seen as alphabetic characters on screen; bluein color
Numbers are stored as byte, int, long, float (default), or double
byte, int, and long can hold only integers
Go to the File Menu (User-interface) and select the icon
Then browse to your preferred folder.
Click OK.
the easiest way to enter data directly into Stata is thru theData Editor (Edit).
it looks like a spreadsheet with columns as variables androws as observations.
Data>>Data Editor>>Data Editor (Edit)
Or by clicking the Data Editor (Edit) icon
File>>Import>>Excel spreadsheet (*.xls;*.xlsx)
In the dialog box, Browse to the directory where the files is saved, specify the Worksheet, and check Import first row as variable names box. Click OK.
Press Crtl+C to copy
Open Stata Editor (Edit) and press Ctrl+V to paste
Click Variable names in the dialog box.
Open an Excel File
Highlight all cells with data, including column labels (Cntrl+A)
OUTPUT
99% 52 52 Kurtosis 4.091113
95% 43 50 Skewness 1.190063
90% 40 47 Variance 46.75679
75% 33 44
Largest Std. Dev. 6.837894
50% 28 Mean 29.76543
25% 25 22 Sum of Wgt. 81
10% 23 22 Obs 81
5% 22 21
1% 21 21
Percentiles Smallest
Age of teacher
99% 5 5 Kurtosis 2.427626
95% 4 5 Skewness .8231276
90% 4 5 Variance 1.511111
75% 3 4
Largest Std. Dev. 1.229273
50% 2 Mean 2.037037
25% 1 1 Sum of Wgt. 81
10% 1 1 Obs 81
5% 1 1
1% 1 1
Percentiles Smallest
length_teach_english
Total 2.037037 1.229273
Male 2.285714 1.069045
Female 1.985075 1.261223
sex mean sd
OUTPUT
1.691482
40 and up 3.11111 1
1.268028 .9574271
30-39 1.85 2.25
1.017626 1.130388
20-29 1.78947 2.44444
er Female Male
age_teach sex
RECODE of
OUTPUT
Total 2.037037 1.2292726 81
Male 2.2857143 1.069045 14
Female 1.9850746 1.2612228 67
sex Mean Std. Dev. Freq.
Summary of length_teach_english
OUTPUT
Total 1.915493 1.1051371 71
Male 2.3846154 1.0439078 13
Female 1.8103448 1.0995517 58
sex Mean Std. Dev. Freq.
Summary of length_teach_english
Highlight the entire output and right-click.
Select from one of four ways to copy output from Stata to a Word or Excel document
01
02
03
04
05
0
Num
ber
of te
ache
rs
20-29 30-39 40 and up
Age of teachers
02
04
06
0
Pe
rcen
t
20-29 30-39 40 and up
Age of teachers
1.91 1.92
2.90
01
23
Me
an
len
gth
of se
rvic
e
20-29 30-39 40 and up
Age of teachers
Figure 3. Length of sevice of English teachers by age group
05
10
15
20
Fre
que
ncy
20 25 30 35 40 45 50 55 60Age of teachers
12
34
5
Female Male
Len
gth
of se
rvic
e
12
34
5
20 30 40 50age_teacher
length of service Fitted values
Female Male
Married Single Widower
Acock, A. A. (2014). A Gentle Introduction to Stata, 4th Ed. 4905 Lakeway Drive, College Station, Texas 77845: Stata Press
https://stats.idre.ucla.edu/stata/modules/
https://stats.idre.ucla.edu/stata/modules/graph8/intro/introduction-to-graphs-in-stata/