set more off

use "C:\Users\Kartini\Dropbox\BF\data replication\dtafiles\mergedallrecoded.dta", clear
gen new=0
count
append using "mergedallrecoded - diff.dta"
replace new=1 if new==.
count

#delimit ;
order v002 v003 dhsid04 dhsidyear year dhsid04matched district urbanrural urban motherid //cluster and survey year identifiers and weights
monthsbreast exclusivebf plainwater stillbreastfeeding exclusivebf6 exclusivebf614 exclusivebf12 monthsbf* //duration of breastfeeding
post2002 fractioncont5 as_walkable5_g numcontaminated5 numcontaminated5_2002 fractioncont5_2002 as_walkable5_g_2002  //contamination and interactions
wfraction_mindistanceC_1m_G wfraction_mindistanceC_1m_G_2002 wfraction_mindistanceC_1m_G_b* fraction_mindistanceC_1m_G fraction_mindistanceC_1m_G_2002 //contamination and interactions
mean_mindistanceU_G wmean_mindistanceU_G fraction_mindistanceU_1m_G wfraction_mindistanceU_1m_G //clean well access measures
childbyear byear1996 byear1997 byear1998 byear1999 byear2000 byear2001 byear2002 byear2003 byear2004 byear2005 byear2006 byear2007 //birth years
childagewithdied childpotentialage childage childdied malechild ageatdeath //child age and gender 
htasdreal wthtsdreal diarrhea //health outcomes
age mothereducyrs fathereducyrs electricity muslim momwthtsd motherworks
pipedwater tubewell surfacewater villagepipedwater  //demographic variables
s116* s118* caseid new midx //groups
;
gen last=1;
drop midx-last;

#delimit ;
foreach var of varlist v002- caseid  {;

qui sum `var' if new==1;
local newmean=r(mean);
qui sum `var' if new==0;
local oldmean=r(mean);

if `newmean'==`oldmean' {; di "`var' same"; };
if `newmean'!=`oldmean' {; di "`var' NOT same: old==`oldmean' & new==`newmean'"; };

};
