I got the following code for generating a table of descriptive statistics. It has some downfalls that I want to address.
This produces the following table.

What I actually looking to generate is the following table:

My question is how should I revise my code to be able to generate the latter table?
Code:
....
collect composite define blank = fvpercent, trim // this is just for adding an empty column between main columns.
...
foreach x of local fvars {
collect: svy: proportion `x', percent
}
collect composite define CI_tot = _r_lb _r_ub, trim delimiter("-")
collect style cell result[CI_tot], sformat("(%s)") nformat(%2.1fc)
collect style cell result[fvpercent], nformat(%2.1fc) sformat("%s")
collect composite define col5 = fvpercent CI_tot
collect composite define col6 = fvrawfrequency
collect composite define col7 = fvfrequency
collect style autolevels result col1 col2 col3 col5 col6 col7, clear
collect label levels result ///
col1 "Weighted % (95% CI)" ///
col2 "Unweighted N" ///
col3 "Weighted N" ///
col5 "Weighted % (95% CI)" ///
col6 "Unweighted N" ///
col7 "Weighted N" ///
, modify
collect style header result [col1 col2 col3 blank col5 col6 col7 ], title(hide) level(label)
collect layout (colname) (result[col5 col6 col7 blank] school_level#result[col1 col2 col3 blank] )
collect style cell border_block, border(right, pattern(nil)) // remove vertical line
collect style cell cell_type[column-header], font(, bold) // bold all the column headers
collect style row stack, spacer nobinder
collect preview
This produces the following table.
What I actually looking to generate is the following table:
My question is how should I revise my code to be able to generate the latter table?

Comment