-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gender Matching Based on Name.do
34 lines (29 loc) · 1.21 KB
/
Gender Matching Based on Name.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
**Missing Gender Project**
**Peilin Qiu 9/5/2019**
***Import the original data and lower the first name
import excel "C:\Peilin\Missing gender\MissingGender.xlsx", sheet("MissingGender") firstrow
gen firstname = lower(SPRIDEN_FIRST_NAME)
order firstname
saveold "C:\Peilin\Missing gender\MissingGender.dta"
clear
***Import the standard data for first name and lower the first name
import excel "C:\Peilin\Missing gender\name_gender.xlsx", sheet("name_gender") firstrow
gen firstname = lower(name)
order firstname
saveold "C:\Peilin\Missing gender\standardgender.dta"
clear
***Data Management-The missing gender dataset
use "C:\Peilin\Missing gender\MissingGender.dta"
sort firstname //sort the observations of firstname
save "C:\Peilin\Missing gender\MissingGender.dta", replace
clear
***Data Management-The missing gender dataset
use "C:\Peilin\Missing gender\standardgender.dta"
sort firstname
save "C:\Peilin\Missing gender\standardgender.dta", replace
clear
***Matching
use "C:\Peilin\Missing gender\MissingGender.dta"
joinby firstname using "C:\Peilin\Missing gender\standardgender.dta",unmatched(master)
saveold "C:\Peilin\Missing gender\MatchedData.dta"
export excel using "OutcomeData"