Hello,


I am working with trade data, and need to generate a table of means of one variable, by two groups. I need the mean of sigma (price elasticity) for each sector within each country (variable gdp), and would like the table to have rows for each sector, columns for each country. I have used the command
Code:
 sort gdp sector
by gdp sector: tabstat sigma, format(%9.2fc)
which gives me the mean values I am looking for, but I just need to somehow put together a table of these. My full data set has 39 sectors, 32 countries so I am hoping to find a quick and convenient way to display the required table. Have included a simple example dataset


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(sigma gdp sector)
3 1 1
4 1 1
2 1 2
5 1 2
4 1 3
2 1 3
7 2 1
4 2 1
6 2 2
8 2 2
9 2 3
4 2 3
6 3 1
5 3 1
3 3 2
9 3 2
2 3 3
5 3 3
end
Apologies for any errors or omissions, I am new here!
Thanks for your help,
Jack