-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1002merge.do
84 lines (60 loc) · 1.6 KB
/
1002merge.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
*** do 1002merge
local do "1002"
local tag "$tag/`do'"
local mergedta "temp1.dta temp2.dta temp3.dta temp4.dta temp5.dta"
*** Check and merge data
** Data check
* Data 1
use "$dsold1", clear
des unitid totenrl
sum unitid totenrl
sort unitid, stable
// list unitid instnm totenrl in 1/10, clean noob
codebook frat* soror*, compact
save temp1, replace
// keep unitid instnm
// export excel idname, firstrow(variables)
* Data 2
use "$dsold2", clear
sort unitid, stable
desc unitid totenrl13
sum unitid totenrl13
nmlab
// list unitid totenrl13 in 1/10, clean noob
// compared and confirmed id match
save temp2, replace
* Data 3
use "$dsold3", clear
sort unitid, stable
codebook, compact
list unitid Greek_flag fratmen1 sororwomen1 if unitid<., clean noob
save temp3, replace
* Data 4
use "$dsold4", clear
sort unitid, stable
codebook, compact
save temp4, replace
* Data 5
use "$dsold5", clear
sort unitid, stable
codebook, compact
save temp5, replace
** Data merge
use temp1, clear
merge 1:1 unitid using temp2
keep if _merge==1 | _merge==3
sum unitid totenrl totenrl13
list unitid instnm totenrl totenrl13 in 1/10, clean noob
drop _merge
merge 1:1 unitid using temp3
keep if _merge==1 | _merge==3
drop _merge
merge 1:1 unitid using temp4
keep if _merge==1 | _merge==3
drop _merge
merge 1:1 unitid using temp5
keep if _merge==1 | _merge==3
drop _merge
foreach nam in `mergedta' {
erase `nam'
}