Stata - FirstSession

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

STATA AND

APPLICATION
INTRODUCTION TO STATA
Software

WHAT Store data

IS Manage data

STATA Statistical analysis

Visulization
User-
friendly

Variety of
useful
functions

WHY STATA Easy-to-


learn
command
syntax

Easy-to-
reach
learning
resources
Limited to

WHY
Not free certain types of
data

NOT No strong

STATA
supporting and
Not allow user-
developing
defined-
network like
functions
open-source
tools
WHAT YOU NEED
Logical thinking, computational thinking

Learning stata commands

Searching skills
STATA Please follow my instruction

INSTALLATION
for installation!
LINK
DOWNLOAD
STATA
Pw:
phantichstata.com
IMPORT DATA FROM EXCEL

Click on File -> File_Import -> File_Import_Excel_Dlg

A new window will open -> Click Btn_Browse -> Choose the
data file -> Open -> Btn_Ok
Please consider Importing first row as columns.
WHERE TO
SEE MY
TABLE?
You could find your
imported data in a
table format by
clicking
TB_Main_Data_Editor
_Browse
THE FIRST COMMAND:
DESCRIBE

It is essential to know
To briefly describe the the types of all features
imported data, using (columns) due to each
the d command type has its own
methods to handle
THE FIRST
COMMAND:
DESCRIBE
IMPORTANCE OF
VARIABLES’ TYPES

Using summerize + variable’s name


command to get the
summarization of a column
IMPORTANCE OF
VARIABLES’ TYPES

What is the problem here?


CONVERT STRING TO
NUMBER

But let’s use this command and check if it could


convert our data. If not, do you have an idea about
the problem?
CONVERT STRING TO
NUMBER

Using command: gen new_column_name =


real(Old column name contains strings)

To convert string to number


The problem is that all of our data
contains “,” character, so STATA
could not convert them to numbers

CONVERT Consequently, you need to remove


all “,” characters inside our variable

STRING TO before any conversion.

NUMBER Using this command to replace


something from a string column:
replace StringColumn =
subinstr(StringColumn,
Replaced_string, "",.)
Another way to convert string to
number is using the following
CONVERT command: destring
Column_name, replace ignore(",")
STRING
TO With this method, you do not
NUMBER need to replace substring before
converting
DIVIDE A COLUMN BY A
NUMBER

To divide a column Example: generate


with a number, using new_col =
/ operator old_col/denominator
DIVIDE A
Now, try to get the result when
COLUMN BY dividing ĐóngCửa by 100 to the
column called divided_close

A NUMBER
Convert data in
PRACTISE %change of index
column to numbers
Search yourself how to

PRACTISE convert column Ngày to


Datetime and then implement
it in your dataset
PRACTISE Let’s try to describe some
columns after conversion
THANK YOU

You might also like