Presentation 1
Presentation 1
Burie Campus
Research and Community Technology Transfer Coordination
STATA Software Application Training for Staffs
Tadele A. (PhD Candidate)
Alebel B.
Belete A.
Nov, 2024
Burie, Ethiopia
12/21/2024
2 Outline
The training has three sessions
Session -1
Introduction to STATA
The Stata user interface
Data entry on STATA
Session -2
Data Management on STATA
Session -3
Methods of Data Analysis
• Descriptive Data Analysis
• Econometrics/Inferential Data Analysis
12/21/2024
3 Objectives
The objective of this training is to improve the ability of the
trainees/staffs to use Stata to generate descriptive statistics and tables
from survey data, as well as carry out preliminarily linear, non-linear
and panel data regression analysis.
In particular, the training aims to train the participants in the following
methods:
Basic file management such as opening, modifying, and saving files
Advance file management such as merging, appending, and
aggregating files
Documenting data files with variable labels and value labels
Generating new variables using various functions and operations
Using regression analysis to study the impact of various variables on
a dependent variable
testing hypotheses using statistical methods
12/21/2024
5 Introduction to STATA
It has got started in California, in the mid-1980s by William
Gould. It was written in the C programming language.
Stata is a statistical package for managing, analyzing, and
graphing data.
STATA is modern and general command driven package for
statistical analyses, data management and graphics.
STATA provides commands to analyze panel data (cross-
sectional time series, longitudinal, repeated-measures, and
correlated data), cross sectional data, time-series data,
survival-time data, cohort study …
STATA has internet capabilities (installing new features,
updating).
12/21/2024
12 What does Stata look like? Cont’d…
The STATA window, when opened, looks like the following
12/21/2024
15 Cont’d…
Review window: shows the history of all commands that have
been entered during one session.
• It displays successfully executed commands in black and
unsuccessful commands along with their error codes in red.
12/21/2024
18 Cont’d…
The STATA Button or Toolbar This bar may be customized to
contain buttons such as:
Open button:- this button is used to open saved STATA files (data,
previous output, do-file, etc).
Save:- this button is used to save statas files (inserted data, STATA
outputs, etc.).
Print:- this button is used to print STATA outputs (print a log or a graph)
Log: this button is used to keep a record of the commands and output
during the STATA session.
Graph:- this button is used to show data graphically
do-file editor:- this button is used to create STATA do-files
data editor:- this button is used to record data, or view data being used
data browser: this button is used to browse data in memory.
12/21/2024
19 Cont’d…
Data entry
Feeding or inserting Data in to STATA memory
Method 1: To insert variable name directly
Click data editor button double click before the first row.
This will pop-up the “generate-create new variable” dialog box shown
below.
12/21/2024
20 Cont’d…dispo_income
Data is a collection of different pieces of row facts.
Information : Data after analysis…….(Data + analysis)
A variable is a characteristic or an attribute that can assume different values.
Based on the values that a variable assumes, a variable is classified into two:
Qualitative and Quantitative.
Qualitative/categorical variable: is a variable that does not assume numeric values.
Quantitative variable: is a variable which assumes numeric values. These
variables are numeric in nature.
select the variable type: you may choose float, etc.
Height (1m, 1.5m, 2.6m,. . .)……float (decimal) = Continuous (quantitative)
Family size (1, 2, 4, 7, . . .)…….int (integer) = Discrete (quantitative)
Gender (male, female)……byte = Nominal/Binary (Qualitative)
Blood type (A, B, AB, O)…..byte = Nominal/Multinomial(Qualitative)
Grade (A, B, C, D, F).....byte = Ordinal/Multinomial(Qualitative)
12/21/2024
21 Cont’d…N
Give variable name (E.g. consumption) from computer
keyboard correctly.
Click submit, or ok buttons.
To Insert values of a variable from computer keyboard
Click on each cell under the variable name > enter the value
Continue the process till all values are entered in the STATA
memory.
Method 2: To copy data from spread sheet or excel
Open the file > Select the data > right Click on selected data > Click
copy
Open the STATA > Click the Data Editor tab > Click Paste > click the
variable names option form the dialog box displayed > Click Save
button.
12/21/2024
22 Cont’d…
Method 3: Opening existing Stata files
Click file menu >click Open >browse the location of the STATA file
Click on the file > click open button
Or
using Use command: use "D:\2017 Material\Training\Sample data.dta", clear
Method 4: Entering data via the command window
Type input in the command window.
Following input type the sequence of variable names (eight letters or
less) separated by blanks.
Command “Input variable name”
For missing data, enter a period for a numeric variable or blank for string variable
When we finish entering the data, type end; that will complete the
data entry then save.
12/21/2024
23 Cont’d…
Import STATA File
Click the File tab > Click import button > select the data format (
xls, xlsx, cvs….etc.) > Select the location that the file
found(browse the file) > select file> import first row as variable
name > click ok
Or
Use insheet command:
insheet using "D:\2017 Material\Training\Disposable
income.xls“
Export STATA File
using GUI (Graphical User Interface)
Click the File tab > Click export button,
Select the location where to save the file
12/21/2024
Give File name > Click ok.
24 Cont’d…
To Save a file in the STATA
Method 1: using GUI (Graphical User Interface)
Click the File tab > Click Save button, or Click the Save button from
STATA toolbar
Select the location where to save the file
Give File name > Click ok.
Method 2:
Copying STATA outputs to Microsoft word document
Select the STATA output > Right click on the selected area
> Click copy text, or click copy table, or click copy as
picture.
Paste to the Microsoft word document
12/21/2024
25 Cont’d…
Saving STATA output in logs
Save the output in log format ( editable in notepad)
Click File > Log > Begin > Give file name >
Select Log(*.Log) >
Select the location where you want to Save the file > Click
Save.
Save the output In smcl format (not editable in notepad)
Click File > Log > Begin > give the name for your file
Select formatted Log(*.smcl)
Select the location where you want to Save > Click Save.
12/21/2024
26 Cont’d…
To edit the data in memory
Method 1: Using the Edit command:
Type edit > press enter
Edit the values to be altered
Method 2: Using GUI
Click on the data editor button > double click the data you
want to edit > type the correct value from computer
keyboard > Click Save button.
12/21/2024
27 Cont’d…
To edit/rename variable, Label, type and format
Method 1:
Click Data from STATA menu tab > Click Variables manager This will pop the
following variables manager dialog box up.
Click on the variable you want to change > type the new name using
12/21/2024 computer keyboard.
28 Cont’d…
Method 2:
Click on the variable name on the variable window
12/21/2024
29 Cont’d…
Method 3: use rename command
Rename abc ABC // this changes the name of the variable from abc to
ABC
To remove/delete the variables and observations in memory
Using the Clear command : - uses to delete all variables in memory
Type clear > press enter
Using the drop command: uses to drop selected variables and
observations in memory:
drop varname1 varname2 :- drops variables varname1 and varname2
drop in 2:-drops the second observation
drop in 3/8 :- drops observations 3 through 8
drop if x>100:- Drops observations of variable x whose value is
greater than 100:
12/21/2024
30 Cont’d…
Using the do-file editor Use:- to reproduce your work later
without having to retype each of the commands Click on the
Do-file Editor button to open the Do-file Editor. Then enter the
commands that you wish to submit to STATA.
12/21/2024