Hello, I am trying to produce a table that offers some summary statistics (Ns and %s, and averages, depending on whether the variable is binary or a count variable) broken down by a 1/0 categorical variable. The final product would look something like this:
Everyone Category 0 Category 1
Work N N N
% % %
Work2 N N N
% % %
Losses Average Average Average
Average age Average Average Average

I have tried using -asdoc- but it seems to only provide statistics by categories down the rows, instead of across the columns. I also tried creating a matrix and saving with putexcel but wasn't able to get that to work properly either. Any leads would be appreciated.


Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input byte(category work work2 losses age)
1 1 0 0 14
0 0 0 0 15
0 0 1 0 14
1 1 1 1 12
0 1 1 0 16
0 1 0 1 18
0 0 1 0 18
1 1 1 2 14
1 1 1 0 12
1 0 0 3 16
1 0 1 0 18
0 1 1 2 18
0 1 1 1 14
0 0 0 2 15
1 0 1 4 15
1 1 1 1 16
0 1 1 2 10
0 1 0 1 19
1 0 1 0 20
0 1 1 1 15
end