Home » Data » Merging data files » Merging HW and BR in Zambia 2001-02 (Merging datasets)
Merging HW and BR in Zambia 2001-02 [message #17792] |
Mon, 03 June 2019 10:03 |
hmyers
Messages: 1 Registered: June 2019
|
Member |
|
|
I'm trying to merge HW and BR in the Zambia 2001-02 (Wave IV) survey. It worked perfectly for Wave II and III, but not for Wave IV for some reason. It seems that 'hwline' in the HW dataset should be between 1 and 5, but is instead between 2 and 26. Hence I am unable to match the entries in the HW dataset to those in the BR dataset. Does anyone know how this might be done?
The code I used for merging waves II and III is as follows:
foreach i in 21 31 {
cd "$ZMHW"
use "ZMHW`i'FL", replace
ren hwcaseid caseid
ren hwline bidx
sort caseid bidx
cd "$cleandata"
save "ZMHW`i'FL_clean", replace
cd "$ZMBR"
merge 1:1 caseid bidx using "ZMBR`i'FL"
drop if hc70==.|hc70==9998
}
Many thanks,
Hugh
|
|
|
Goto Forum:
Current Time: Fri Dec 27 03:05:41 Coordinated Universal Time 2024
|