Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save on disk and reload estimates for esttab

Tags:

stata

Is there any way to save and reload data in between an eststo command and an esttab?

What I would love is something like the following:

eststo: quietly reg a b
estsave using foo.est, replace

***

*Some other File
estload using foo.est
esttab foo.tex

Any other alternatives that let me play with the way I output regressions by trial and error (without having to re-run them and having to be at an interactive prompt) would be enormously helpful.

like image 947
David Berger Avatar asked Sep 18 '25 01:09

David Berger


1 Answers

You can store estimates on disk with the estimates save command:

sysuse auto, clear

quietly regress price mpg
estimates save foo1

quietly regress price trunk
estimates save foo2

quietly regress price weight
estimates save foo3

The above code snippet creates 3 files in your current working directory containing the estimates:

foo1.ster
foo2.ster
foo3.ster

You can then reload these and use them with esttab non-interactively and in any way you like with the estimates use command:

estimates use foo2
esttab .

----------------------------
                      (1)   
                    price   
----------------------------
trunk               216.7** 
                   (2.81)   

_cons              3183.5** 
                   (2.87)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

estimates use foo1
esttab .

----------------------------
                      (1)   
                    price   
----------------------------
mpg                -238.9***
                  (-4.50)   

_cons             11253.1***
                   (9.61)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

estimates use foo3
esttab .

----------------------------
                      (1)   
                    price   
----------------------------
weight              2.044***
                   (5.42)   

_cons              -6.707   
                  (-0.01)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!