Thursday, December 20, 2018

Getting summary statistics for several vars in a single MSword table

May be this is too much of an expectation, but I've been thinking of asking whether there is any command to get the summary statistics for all the variables in a dataset, in a single table. My 4 variables are age, ethnicity, parity and mobile phone use:

[CODE]
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(WAGE ethnicity par mobile)
2 2 0 0
1 2 2 0
2 2 2 0
3 2 4 0
7 2 5 0
6 2 4 0
5 2 4 0
4 2 4 0
6 2 5 0
1 2 2 0
5 2 5 0
1 2 2 0
1 2 2 0
1 2 2 0
1 2 0 0
4 2 4 1
2 0 2 0
6 2 2 0
2 2 2 0
3 2 4 0
3 2 2 0
4 2 4 0
7 2 4 0
4 2 5 0
3 2 4 0
5 0 5 1
2 2 2 0
7 2 5 0
5 2 4 0
4 2 5 0
7 2 4 0
2 2 2 0
2 2 2 0
7 2 5 0
4 2 4 0
5 2 5 0
6 2 5 0
3 2 5 0
4 2 4 0
3 2 4 0
5 2 5 0
4 2 4 0
4 0 4 0
4 2 4 0
4 2 4 0
2 2 2 0
5 2 5 0
6 2 4 0
7 2 4 0
7 2 4 0
7 2 4 0
3 2 4 0
1 2 0 0
5 0 5 0
6 2 5 0
3 2 5 0
4 2 5 0
2 2 5 0
4 2 5 0
1 2 2 0
1 2 2 0
5 2 5 0
1 2 0 0
6 3 5 0
1 3 0 0
4 2 5 0
1 2 0 0
6 2 0 0
2 2 2 0
3 2 4 0
7 2 5 1
4 2 4 0
5 2 2 0
4 2 2 0
5 2 4 1
5 2 4 0
3 2 4 0
5 2 4 1
3 2 4 0
4 2 5 0
5 2 4 0
2 2 2 1
4 0 4 0
3 2 0 0
2 2 2 0
3 2 2 0
6 2 5 0
1 2 2 1
7 2 4 0
6 2 2 1
1 2 0 0
5 2 4 1
3 2 4 0
2 2 2 0
4 2 4 1
7 2 5 0
2 2 4 0
5 2 4 0
7 2 5 1
2 2 5 0
end
and the aim is get a table like this with n and % reported in two separate columns (weight/CIs are optional)

Array
Thank you.

No comments:

Post a Comment