I am new on STATA 17 and I want to use new feature for customizable tables to export results into an already designed table layout in excel.
tha table that I want to produce looks like this:
Province | Dejure | Defacto | ||||
both sex | male | female | both sex | male | female | |
All | ||||||
KG | ||||||
E | ||||||
N | ||||||
S | ||||||
W |
The dataset looks like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(L01 P03) float(dejure defacto) 1 2 1 1 1 1 1 . 1 1 1 1 1 1 1 . 1 2 1 1 1 2 1 . 1 1 1 1 1 2 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 1 1 . 1 2 1 . 4 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 2 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 5 2 1 1 1 2 1 1 1 2 1 . 1 2 1 1 1 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 . 1 2 1 1 1 1 1 . 1 1 1 . 1 1 1 1 1 1 1 . 1 2 1 1 1 1 1 1 4 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 . 5 1 1 1 1 2 1 1 1 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 end label values L01 L01 label def L01 1 "KG", modify label def L01 2 "S", modify label def L01 3 "W", modify label def L01 4 "N", modify label def L01 5 "E", modify label values P03 P03 label def P03 1 "Male", modify label def P03 2 "Female", modify
collect create Table1a
collect get: table L01 P03 if dejure==1
collect create Table1b
collect get: table L01 P03 if defacto==1
After using the codes above, I got two distinct tables in stata results window. Now my question is: How could I combined the results from the two tables in Stata in order to get one table formatted as the example above.
Thanks
0 Response to Combining results from different collections and export results in excel sheet
Post a Comment