clear cap log close cap clear matrix set more off set mem 200m set matsize 1100 program drop _all version 11.0 gl root "C:\DROPBOX\Dropbox\TESTS_COLOMBIA" gl testdata "$root\DATA\CLEANDATA\v4_tests\idb_portal\tests_bogota.dta" gl out "$root\DATA\CODE\v4_analysis_tests\idb_portal\descriptives" log using "$out/sample charact battery b.log", replace use "$testdata" keep if battery == 1 drop if b_flag_outlier == 1 sum b_tot_cog b_tot_lr b_tot_le b_tot_mf b_tot_mg *final analysis sample 1305 observations * Age Categories local c = 12 g age_cat_`c'mth =. lab var age_cat_`c'mth "Months Category, `c' months intervals" local j = 1 forvalues i=7(`c')37 { local aux = `i'+`c'-1 replace age_cat_`c'mth = `j' if b_age_mth>=`i' & b_age_mth<=`aux' local j = `j'+1 } replace age_cat_`c'mth = 1 if b_age_mth==6 | b_age_mth==5 tempfile battb save `battb', replace ***********Bayley************ u `battb', clear foreach m in cog lr le mf mg { label var b_tot_`m' "All Children" } forvalues i=1(1)3 { foreach m in cog lr le mf mg { gen a_b_tot_`m'_`i' = b_tot_`m' if age_cat_`c'mth == `i' } } local j = 1 foreach cat in " 6 - 18" " 19 - 30" " 31 - 42" { foreach m in cog lr le mf mg { label var a_b_tot_`m'_`j' "`cat'" } local j = `j'+1 } foreach m in cog lr le mf mg { local r b_tot_`m' local a_`m' a_`r'_1 a_`r'_2 a_`r'_3 b_tot_`m' } estpost sum `a_cog' `a_lr' `a_le' `a_mf' `a_mg' `a_se', d est store A esttab A using "$out\desc_battery B_`c'm.csv", replace wide plain /// title(Table: Raw Score Battery B, All Children and by 6 Months Age Groups) /// refcat(a_b_tot_cog_1 "Cognitive" a_b_tot_lr_1 "Language Receptive" a_b_tot_le_1 "Language Expressive" a_b_tot_mf_1 "Fine Motor" /// a_b_tot_mg_1 "Gross Motor" , nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs label var b_tot_cog "Cognitive" label var b_tot_lr "Receptive Language" label var b_tot_le "Expressive Language" label var b_tot_mf "Fine Motor" label var b_tot_mg "Gross Motor" estpost sum b_tot_cog b_tot_lr b_tot_le b_tot_mf b_tot_mg, d est store B esttab B using "$out\desc_battery B_all.csv", replace wide plain /// title(Table: Raw Score Battery B, All Children) /// refcat(b_tot_cog "Bayley-III", nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs ***********Battelle************ u `battb', clear drop if bat_flag_outlier == 1 keep if flag_all_b_bat ==1 foreach m in cog lang mot soc adp tot { label var bat_`m' "All Children" } forvalues i=1(1)3 { foreach m in cog lang mot soc adp tot { gen a_bat_`m'_`i' = bat_`m' if age_cat_`c'mth == `i' } } local j = 1 foreach cat in " 6 - 18" " 19 - 30" " 31 - 42" { foreach m in cog lang mot soc adp tot { label var a_bat_`m'_`j' "`cat'" } local j = `j'+1 } foreach m in cog lang mot soc adp tot { local r bat_`m' local a_`m' a_`r'_1 a_`r'_2 a_`r'_3 bat_`m' } estpost sum `a_cog' `a_lang' `a_mot' `a_soc' `a_adp' `a_tot', d est store A esttab A using "$out\desc_battery B_`c'm.csv", append wide plain /// refcat(a_bat_cog_1 "Cognitive" a_bat_lang_1 "Communication" a_bat_mot_1 "Motor" a_bat_soc_1 "Personal-Social" a_bat_adp_1 "Adaptive Skills" /// a_bat_tot_1 "Total Score", nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs label var bat_cog "Cognitive" label var bat_lang "Communication" label var bat_mot "Motor" label var bat_soc "Personal-Social" label var bat_adp "Adaptive Skills" label var bat_tot "Total Score" estpost sum bat_cog bat_lang bat_mot bat_soc bat_adp bat_tot, d est store B esttab B using "$out\desc_battery B_all.csv", append wide plain /// refcat(bat_cog "BDI-2 (Battelle)", nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs ***********Motor Milestones************ u `battb', clear drop if mil_flag_outlier == 1 keep if flag_all_b_mil ==1 foreach m in tot { label var mil_`m' "All Children" } forvalues i=1(1)3 { foreach m in tot { gen a_mil_`m'_`i' = mil_`m' if age_cat_`c'mth == `i' } } local j = 1 foreach cat in " 6 - 18" " 19 - 30" " 31 - 42" { foreach m in tot { label var a_mil_`m'_`j' "`cat'" } local j = `j'+1 } foreach m in tot { local r mil_`m' local a_`m' a_`r'_1 mil_`m' } estpost sum `a_tot', detail est store A esttab A using "$out\desc_battery B_`c'm.csv", append wide plain /// refcat(a_mil_tot_1 "Gross Motor", nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs foreach m in tot { label var mil_`m' "Gross Motor" } estpost sum `r', d est store B esttab B using "$out\desc_battery B_all.csv", append wide plain /// refcat(a_mil_tot "WHO-Motor", nolabel) /// nomtitle collabel("N" "Mean" "Median" "SD" "Min" "Max") /// cells ("count(fmt(0)) mean(fmt(3)) p50(fmt(1)) sd(fmt(3)) min(fmt(2)) max(fmt(2))") label lines nonum noobs log close