-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use in NCA study for WC Myanmar
- Loading branch information
0 parents
commit 691046c
Showing
10 changed files
with
8,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
PURPOSE: WC - NCA Lashio Project | ||
AUTHOR: Nicholus | ||
CREATED: 02 Dec 2019 | ||
MODIFIED: | ||
THINGS TO DO: | ||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ | ||
|
||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
** IMPORT DATASET ** | ||
|
||
import excel using "$raw/NCA_LAISHIO_WC_FINAL_2019_12_11_08_57_30_839866-group-name-removed.xls", describe | ||
|
||
|
||
// sheet("data") cellrange(A7:EI103)firstrow case(lower) allstring clear | ||
|
||
|
||
local n_sheets `r(N_worksheet)' | ||
forvalues j = 1/`n_sheets' { | ||
local sheet_`j' `r(worksheet_`j')' | ||
} | ||
|
||
forvalues i = 1/`n_sheets' { | ||
local range_`i' `r(range_`i')' | ||
} | ||
|
||
|
||
forvalues j = 1/`n_sheets' { | ||
import excel using "$raw/NCA_LAISHIO_WC_FINAL_2019_12_11_08_57_30_839866-group-name-removed.xls", /// | ||
sheet("`sheet_`j''") /// | ||
firstrow case(lower) /// | ||
cellrange(`range_`j'') /// | ||
allstring clear | ||
if `j' <= 2 { | ||
count if !mi(_index) | ||
di "`sheet_`j'' : `r(N)'" | ||
save "$dta/`sheet_`j''.dta", replace | ||
} | ||
else if "`sheet_`j''" == "consent_child_vc_rep" { | ||
|
||
keep if !mi(child_ill) | ||
count if !mi(child_ill) | ||
di "`sheet_`j'' : `r(N)'" | ||
save "$dta/`sheet_`j''.dta", replace | ||
} | ||
else if "`sheet_`j''" == "consent_grp_q2_5_to_q2_7" { | ||
|
||
keep if !mi(child_bf) | ||
count if !mi(child_bf) | ||
di "`sheet_`j'' : `r(N)'" | ||
save "$dta/`sheet_`j''.dta", replace | ||
} | ||
else if "`sheet_`j''" == "consent_ancpast_rep" { | ||
|
||
keep if !mi(ancpast_adopt) | ||
count if !mi(ancpast_adopt) | ||
di "`sheet_`j'' : `r(N)'" | ||
save "$dta/`sheet_`j''.dta", replace | ||
} | ||
else if "`sheet_`j''" == "consent_childanthro_rep" { | ||
|
||
keep if !mi(cal_anthro) | ||
count if !mi(cal_anthro) | ||
di "`sheet_`j'' : `r(N)'" | ||
save "$dta/`sheet_`j''.dta", replace | ||
} | ||
|
||
} | ||
|
||
clear | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
PURPOSE: WC - NCA Lashio Project | ||
AUTHOR: Nicholus | ||
CREATED: 02 Dec 2019 | ||
MODIFIED: | ||
THINGS TO DO: | ||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ | ||
|
||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
** PREPARE DATASET TO COMBINE AT ONE ** | ||
// Main respondent dataset // | ||
use "$dta/nca_laishio_v3.dta", clear | ||
|
||
gen key = _index | ||
order key, before(_index) | ||
drop _index | ||
|
||
save "$dta/respondent.dta",replace | ||
clear | ||
|
||
|
||
// hh members dataset // | ||
use "$dta/consent_hh_grp_grp_hh.dta", clear | ||
|
||
gen key = _parent_index | ||
order key, before(_parent_index) | ||
|
||
gen hh_mem_key = _parent_index + "_" + test | ||
order hh_mem_key, after(key) | ||
|
||
drop _index _parent_index | ||
save "$dta/hh_roster", replace | ||
clear | ||
|
||
// child health dataset // | ||
use "$dta/consent_child_vc_rep.dta", replace | ||
|
||
gen key = _parent_index | ||
order key, before(_parent_index) | ||
|
||
gen hh_mem_key = _parent_index + "_" + child_id_health | ||
order hh_mem_key, after(key) | ||
|
||
drop _index _parent_index | ||
save "$dta/child_health", replace | ||
clear | ||
|
||
|
||
// child iycf // | ||
use "$dta/consent_grp_q2_5_to_q2_7.dta", clear | ||
|
||
gen key = _parent_index | ||
order key, before(_parent_index) | ||
|
||
gen hh_mem_key = _parent_index + "_" + child_id_iycf | ||
order hh_mem_key, after(key) | ||
|
||
drop _index _parent_index | ||
save "$dta/child_iycf", replace | ||
clear | ||
|
||
// child anthro // | ||
use "$dta/consent_childanthro_rep.dta", clear | ||
|
||
gen key = _parent_index | ||
order key, before(_parent_index) | ||
|
||
gen hh_mem_key = _parent_index + "_" + child_id_nut | ||
order hh_mem_key, after(key) | ||
|
||
drop _index _parent_index | ||
save "$dta/child_anthro", replace | ||
clear | ||
|
||
|
||
// mother health | ||
use "$dta/consent_ancpast_rep.dta", clear | ||
|
||
gen key = _parent_index | ||
order key, before(_parent_index) | ||
|
||
gen hh_mem_key = _parent_index + "_" + women_id_pregpast | ||
order hh_mem_key, after(key) | ||
|
||
drop _index _parent_index | ||
save "$dta/mom_health", replace | ||
clear | ||
|
||
******************************************************************************** | ||
******************************************************************************** | ||
** PREPARE TO COMBINE AS ONE CHILD DATASET ** | ||
|
||
use "$cdta/respondent_cleanded.dta",clear | ||
tostring key, replace | ||
|
||
merge 1:m key using "$dta/hh_roster" | ||
|
||
keep if _merge == 3 | ||
drop _merge | ||
|
||
order hh_mem_key test, after(key) | ||
|
||
merge 1:m hh_mem_key using "$dta/child_health" | ||
|
||
keep if _merge == 3 | ||
drop _merge | ||
|
||
order hh_mem_key test child_id_health, after(key) | ||
|
||
merge 1:1 hh_mem_key using "$dta/child_iycf" | ||
|
||
drop _merge | ||
|
||
order hh_mem_key test child_id_health child_id_iycf, after(key) | ||
|
||
merge 1:1 hh_mem_key using "$dta/child_anthro" | ||
|
||
drop _merge | ||
|
||
order hh_mem_key test child_id_health child_id_iycf child_id_nut, after(key) | ||
|
||
save "$dta/child_dataset_combined.dta", replace | ||
|
||
clear | ||
|
||
|
||
** PREPARE TO COMBINE AS ONE MOTHER DATASET ** | ||
use "$cdta/respondent_cleanded.dta",clear | ||
tostring key, replace | ||
|
||
merge 1:m key using "$dta/hh_roster" | ||
|
||
keep if _merge == 3 | ||
drop _merge | ||
|
||
order hh_mem_key test, after(key) | ||
|
||
merge 1:m hh_mem_key using "$dta/mom_health" | ||
|
||
keep if _merge == 3 | ||
drop _merge | ||
|
||
order hh_mem_key test, after(key) | ||
|
||
save "$dta/mom_dataset_combined.dta", replace | ||
|
||
clear | ||
|
||
|
||
|
Oops, something went wrong.