//Esttab command for correlation (in MS Excel format) ssc install estout sysuse auto.dta,clear //Two step procedure //Step 1: Run estpost commands that will perform the estimation //Step 2: Output the results in presentable way ************************** *Step 1 * ************************** estpost correlate price mpg rep78 //Matrix option estpost correlate price mpg rep78, matrix //Matrix and Listwise option //listwise option is used to handle the missing values and matrix option returns the correlation matrix for all the varaible in the list estpost correlate price mpg rep78, matrix listwise ************************** *Step 2 * ************************** esttab using results.rtf, replace esttab using results.rtf, replace unstack not noobs b(2) nonote label //unstack: To have multiple columns //not: surpress t-stats //noobs: remove number of observations data //b(): specify number of decimals //nonote: to remove any note //compress: reduce horizontal spacing //label:to use label instead of varaible name //Esttab command for correlation (in MS excel format) estpost correlate price mpg rep78, matrix listwise esttab using correlationresults.csv, replace unstack not noobs compress b(2) nonote label