You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file makes it possible to run multiple do files without having to open each one individually. Executing the full code will run all do files available.
4
+
5
+
_**Important Notes**_
6
+
* The do files are run sequentially, so this will take several hours to complete. Breaking each loop into its own do file and running them in separate Stata windows will decrease the time to completion
7
+
* If the wave summary stats are not needed, the runtime can be reduced by commenting out the call to the Summary Statistics do file at the bottom of each wave file.
8
+
* Some countries borrow data from earlier waves to fill gaps in the survey instrument. Running the waves in order reduces your likelihood of getting an error.
9
+
* The script will remove all created data from the folders before executing the do file to ensure that there aren't errors in versioning. Archive any data you want to save before running this script.
//Note - this will take a while to run everything sequentially; it can be done in parallel by running each block in a separate window or getting some friends to help out.
2
+
3
+
global maindir "../.."
4
+
global subdirs "final_data created_data temp_data"
5
+
6
+
//Nigeria
7
+
forvalues k = 1/4 {
8
+
local folder "$maindir/Nigeria GHS/Nigeria GHS Wave `k'"
9
+
cd "`folder'"
10
+
foreach subdir in $subdirs {
11
+
//di "`folder'/Final DTA Files/`subdir'"
12
+
capture local files : dir "`folder'/Final DTA Files/`subdir'" files "*.dta"
13
+
if!_rc {
14
+
foreach file in `files' {
15
+
erase "`folder'/Final DTA Files/`subdir'/`file'"
16
+
}
17
+
}
18
+
else {
19
+
di "Folder `subdir' not found, code may produce an error"
20
+
}
21
+
}
22
+
do "`folder'\EPAR_UW_Nigeria_GHS_W`k'.do"
23
+
24
+
}
25
+
26
+
//Ethiopia
27
+
28
+
forvalues k = 1/5 {
29
+
local folder "$maindir/Ethiopia ESS/Ethiopia ESS Wave `k'"
30
+
cd "`folder'"
31
+
foreach subdir in $subdirs {
32
+
//di "`folder'/Final DTA Files/`subdir'"
33
+
capture local files : dir "`folder'/Final DTA Files/`subdir'" files "*.dta"
34
+
if!_rc {
35
+
foreach file in `files' {
36
+
erase "`folder'/Final DTA Files/`subdir'/`file'"
37
+
}
38
+
}
39
+
else {
40
+
di "Folder `subdir' not found, code may produce an error"
41
+
}
42
+
}
43
+
do "`folder'\EPAR_UW_Ethiopia_ESS_W`k'.do"
44
+
}
45
+
46
+
47
+
//Tanzania
48
+
forvalues k in 1/6 {
49
+
if k==6 {
50
+
local folder "$maindir/Tanzania NPS/Tanzania NPS SDD"
51
+
}
52
+
else {
53
+
local folder "$maindir/Tanzania NPS/Tanzania NPS Wave `k'"
54
+
}
55
+
cd "`folder'"
56
+
foreach subdir in $subdirs {
57
+
//di "`folder'/Final DTA Files/`subdir'"
58
+
capture local files : dir "`folder'/Final DTA Files/`subdir'" files "*.dta"
59
+
if!_rc {
60
+
foreach file in `files' {
61
+
erase "`folder'/Final DTA Files/`subdir'/`file'"
62
+
}
63
+
}
64
+
else {
65
+
di "Folder `subdir' not found, code may produce an error"
66
+
}
67
+
68
+
}
69
+
do "`folder'\EPAR_UW_Tanzania_NPS_W`k'.do"
70
+
}
71
+
72
+
73
+
//Malawi
74
+
forvalues k = 1/4 {
75
+
local folder "$maindir/Malawi IHS/Malawi IHS Wave `k'"
76
+
cd "`folder'"
77
+
foreach subdir in $subdirs {
78
+
//di "`folder'/Final DTA Files/`subdir'"
79
+
capture local files : dir "`folder'/Final DTA Files/`subdir'" files "*.dta"
80
+
if!_rc {
81
+
foreach file in `files' {
82
+
erase "`folder'/Final DTA Files/`subdir'/`file'"
83
+
}
84
+
}
85
+
else {
86
+
di "Folder `subdir' not found, code may produce an error"
87
+
}
88
+
89
+
}
90
+
do "`folder'\EPAR_UW_Malawi_IHS_W`k'.do"
91
+
}
92
+
93
+
//Uganda
94
+
forvalues k in 1/8 {
95
+
if `k'!=6 {
96
+
local folder "$maindir/Uganda UNPS/Uganda UNPS Wave `k'"
97
+
cd "`folder'"
98
+
foreach subdir in $subdirs {
99
+
//di "`folder'/Final DTA Files/`subdir'"
100
+
capture local files : dir "`folder'/Final DTA Files/`subdir'" files "*.dta"
101
+
if!_rc {
102
+
foreach file in `files' {
103
+
erase "`folder'/Final DTA Files/`subdir'/`file'"
104
+
}
105
+
}
106
+
else {
107
+
di "Folder `subdir' not found, code may produce an error"
0 commit comments