----------------------------------------------------------------------------------------
~ IMPORTING DATA ~
----------------------------------------------------------------------------------------
Clear, set the directory and import (.dta):
clear
cd "C:\Users\...\Downloads"
use dataset.dta
// Built in datasets: sysuse dir, sysuse auto
Import (.csv):
clear
cd "C:\Users\...\Downloads"
type dataset.csv (analyse data only)
insheet using dataset.csv, c (if delim is comma)
(OR)
insheet using dataset.csv, delim(;)
(OR)
insheet using dataset.csv, c names (if delim is comma)
// IF XLS, SAVE IN CVS IN EXCEL AND PROCEED LIKE CVS
Generating missing values:
summ black_pop2010
gen aux_black_pop2010=prop_black*tot_pop2010
replace black_pop2010=aux_black_pop2010 if black_pop2010==. & aux_black_pop2010!=.
drop aux_black_pop2010
summ
~1~
~ IMPORTING DATA ~
----------------------------------------------------------------------------------------
Clear, set the directory and import (.dta):
clear
cd "C:\Users\...\Downloads"
use dataset.dta
// Built in datasets: sysuse dir, sysuse auto
Import (.csv):
clear
cd "C:\Users\...\Downloads"
type dataset.csv (analyse data only)
insheet using dataset.csv, c (if delim is comma)
(OR)
insheet using dataset.csv, delim(;)
(OR)
insheet using dataset.csv, c names (if delim is comma)
// IF XLS, SAVE IN CVS IN EXCEL AND PROCEED LIKE CVS
Generating missing values:
summ black_pop2010
gen aux_black_pop2010=prop_black*tot_pop2010
replace black_pop2010=aux_black_pop2010 if black_pop2010==. & aux_black_pop2010!=.
drop aux_black_pop2010
summ
~1~