How would I copy the the contents of eststo
and create another eststo
?
For example:
sysuse auto2, clear
eststo clear
eststo estimates1: reg price mpg rep78 headroom trunk weight length turn, robust
estadd local aa "abc"
estadd local bb "bcd"
esttab estimates1
What I want to do is to copy estimates1
and create estimates2
. The two should be identical.
Of course, one way to do this is to just re-run the regression again:
eststo clear
eststo estimates1: reg price mpg rep78 headroom trunk weight length turn, robust
estadd scalar obs=e(N)
estadd local aa "abc"
estadd local bb "bcd"
eststo estimates2: reg price mpg rep78 headroom trunk weight length turn, robust
estadd scalar obs=e(N)
estadd local aa "abc"
estadd local bb "bcd"
esttab estimates1 estimates2, stats(obs aa bb)
But is there a way to do something like this (incorrect):
eststo estimates2 = estimates1
The following works for me:
sysuse auto2, clear
eststo clear
eststo estimates1: reg price mpg rep78 headroom trunk weight length turn, robust
estadd scalar obs=e(N)
estadd local aa "abc"
estadd local bb "bcd"
eststo estimates2
esttab estimates1 estimates2, stats(obs aa bb)
Note that the following also works:
esttab estimates1 estimates1, stats(obs aa bb)
Both approaches will produce the desired output:
--------------------------------------------
(1) (2)
price price
--------------------------------------------
mpg -104.5 -104.5
(-1.21) (-1.21)
rep78 723.2* 723.2*
(2.29) (2.29)
headroom -656.0* -656.0*
(-2.23) (-2.23)
trunk 79.23 79.23
(1.05) (1.05)
weight 5.286* 5.286*
(2.66) (2.66)
length -93.33 -93.33
(-1.51) (-1.51)
turn -196.6 -196.6
(-1.24) (-1.24)
_cons 16142.5* 16142.5*
(2.08) (2.08)
--------------------------------------------
obs 69 69
aa abc abc
bb bcd bcd
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001