I am relatively new to Stata and have been trying to merge multiple tables unsuccessfully using the command -dtable-. What I got so far was combining the different tables using "collect combine" then displaying then using "collect layout". The problem is that the results are showing weirdly. They are piled up instead of being side by side, leaving blank spaces in the combined table.
Here's the code I've been trying to run:
When I combine only two "dtables" (e.g., a1 and a2), it works perfectly. See the code below:
Any help would be greatly appreciated!
Here's the code I've been trying to run:
Code:
*Panel A - Household characteristics dtable age_dad age_mom edu_dad edu_mom gp_present rural fath_abs moth_abs hhsizem, by(pension_gender, nototal) name(a1) dtable age_dad age_mom edu_dad edu_mom gp_present rural fath_abs moth_abs hhsizem, by(who_eligible, nototal) name(a2) *Panel B - pension receipt preserve drop if pension != 1 generate no_pen_inc = totminc - pensionQ label var no_pen_inc "Non-pension income" dtable pension_m pension_f pensionQ no_pen_inc inc_pc, by(pension_gender, nototal) name(b1) dtable pension_m pension_f pensionQ no_pen_inc inc_pc, by(who_eligible, nototal) name(b2) *Panel C - Anthropometric data restore dtable haz whz, by(pension_gender, nototal) name(c1) dtable haz whz, by(who_eligible, nototal) name(c2) * Combine the collections collect combine all = a1 a2 b1 b2 c1 c2 * Change the display format for means and standard deviations collect style cell result[mean sd], nformat(%8.2fc) * Define the layout for the combined table collect layout (collection#var) (pension_gender#result who_eligible#result)
When I combine only two "dtables" (e.g., a1 and a2), it works perfectly. See the code below:
Code:
* Combine the collections collect combine all2 = a1 a2 * Change the display format for means and standard deviations collect style cell result[mean sd], nformat(%8.2fc) * Define the layout for the combined table collect layout (var) (pension_gender#result who_eligible#result)
