I am using stata 18.5 for windows
I have the following code. I want to see all the results of the loop into a single stacked table but only get the last looped result.
I've tried multple variation of the coding and cannot figure it out.
collect clear
svyset [pweight=weightvar]
foreach var in var list gender married etc... {
collect _r_b _r_ci: svy: mean hours_worked, over (year_group `var')
collect style cell result [_r_b _r_ci], nformat (%4.1f)
collect layout (`var'#result) (year_group#smdset)
}
collect style head cmdset, title(hide) level(hide)
collect preview
I have the following code. I want to see all the results of the loop into a single stacked table but only get the last looped result.
I've tried multple variation of the coding and cannot figure it out.
collect clear
svyset [pweight=weightvar]
foreach var in var list gender married etc... {
collect _r_b _r_ci: svy: mean hours_worked, over (year_group `var')
collect style cell result [_r_b _r_ci], nformat (%4.1f)
collect layout (`var'#result) (year_group#smdset)
}
collect style head cmdset, title(hide) level(hide)
collect preview

Comment