Dear Statalisters,

I am trying to create tables for a couple of variables over two rounds of data 2012 and 2018 as shown in the below code.

The output is correct but I am trying to find a way that tabulates female with health_ins_l in 2012 followed by 2018 and then the next variable and so on.
Is there a way to do so and does not require that I tabout each variable separately?

Thank you,
Maye


Code:
*2012
tabout  female age_group urban qwealth  health_ins_l if round==2012 ///
[aw=expan_indiv] using "output/healthins.xls", ///
replace  c(freq row) ///
h1(Health insurance: 2012) h3(nil) clab() lines(none) ptotal() f(2)

tabout  female age_group urban qwealth  health_ins_l if round==2018 ///
[aw=expan_indiv] using "output/healthins.xls", ///
append  c(freq row) ///
h1(Health insurance: 2018) h3(nil) clab() lines(none) ptotal() f(2)
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(female age_group) byte(urban qwealth health_ins_l) int round
0 4 1 5 . 2006
1 3 1 5 . 2006
1 1 1 5 . 2006
0 1 1 5 . 2006
1 5 1 5 . 2006
1 5 1 5 . 2006
0 1 1 5 . 2006
0 4 1 5 . 2006
1 3 1 5 . 2006
0 1 1 5 . 2006
1 1 1 5 . 2006
1 3 1 4 . 2006
1 1 1 4 . 2006
0 1 1 4 . 2006
0 1 1 4 . 2006
0 1 1 4 . 2006
1 1 1 4 . 2006
1 1 1 4 . 2006
0 1 1 4 . 2006
1 1 1 4 . 2006
end
label values female Lfemale
label def Lfemale 0 "0. male", modify
label def Lfemale 1 "1. female", modify
label values age_group LABELage_group
label def LABELage_group 1 "1. <29", modify
label def LABELage_group 3 "3. 40-49", modify
label def LABELage_group 4 "4. 50-59", modify
label def LABELage_group 5 "5. 60+", modify
label values urban urbrur
label def urbrur 1 "1. urban", modify
label values health_ins_l health_ins_l