Saturday, March 18, 2017

Stata Tip: Never Ever Copy-Paste, Use Outreg2 and Tabstat To Their Fullest

Yes, we all know about outreg2 (I hope), but most of us don't use it to its fullest potential (I think). My graduate student sent me this handy little PowerPoint presentation on outreg2 (thank you, Sam). I had no idea you could use outreg2 to make nice tables of descriptive statistics. 

I have been using the tabstat command to make tables of descriptive statistics. Only recently, I learned that it becomes so much more useful when using the longstub option along with it. Have a look at the tabstat help for more details. 

My favorite outreg2 option? addstat! See the outreg2 help for more details, but I will leave you with one useful thing you can do with it: Imagine you have a regression table showing the results of your analysis conducted on several different samples (sample1, sample2, etc.)  You probably want to show the mean of your dependent variable in the different samples. What to do? 

regress y x if sample=1
sum y if sample=1
outreg2 using TableName, addstat(Dependent Variable, rmean)

Then do the same for the other samples. Voila! The mean of the dependent variable shows up just below the R-squared! 

1 comment: