I want to create a table of descriptive statistics. To be more specific, The table should contains 6 rows and 4 columns, something like this:
Descriptive Statistics
-----------------------------------------------------------
Cohort A Cohort B Cohort C
-----------------------------------------------------------
Urban Residence 0.263 0.313 0.264
Years of Schooling 5.585 7.280 7.592
Ethnic Majority 0.928 0.918 0.915
Want Children 0.990 0.992 0.991
Ever Pregnant 0.991 0.987 0.992
-----------------------------------------------------------
Observations 3553 2450 4694
-----------------------------------------------------------
The official document for Estout provides some clues but does not make it crystal clear. Here are the steps I followed:
- Generate an arbitrary variable;
- Run regression, separately for each cohort;
- Collect the results;
- Make the table
Here are the code:
eststo clear
gen y=uniform()
quietly regress y urban eduy han want_birth preg if cohort==1, noconstant
estadd mean
eststo d1
quietly regress y urban eduy han want_birth preg if cohort==2, noconstant
estadd mean
eststo d2
quietly regress y urban eduy han want_birth preg if cohort==3, noconstant
estadd mean
eststo d3
esttab d1 d2 d3, cells(mean(fmt(%8.3f))) label nonotes nonumber nodepvars mtitles("Cohort A" "Cohort B" "Cohort C") width(1\hsize) title(Descriptive Statistics)
Do you have copy writer for so good articles? If so please give me contacts, because this really rocks! :)
ReplyDelete