# st: re: how to access e(b) and e(V)

 From Kit Baum To statalist@hsphsun2.harvard.edu Subject st: re: how to access e(b) and e(V) Date Tue, 20 Oct 2009 07:00:17 -0400

```<>
Philomela said

```
I would like to export the coefficient matrix and the variance covariance matrix into excel to do some calculations-i need very exact values, so i can't use the output. Where does Stata store these matrices and how can I access them?
```

```
If you want exact computations, stay away from Excel. Just save the matrices as Martin said in matrix b and V and use Stata's matrix language to do the computations you need. Better yet, do it in Mata:
```
sysuse auto,clear
qui reg price mpg weight turn length
mata:
b = st_matrix("e(b)")
V = st_matrix("e(V)")
b
V
// these results are held to full internal precision
printf("The first element of b is %20.12f\n",b[1])
printf("The 1,1 element of V is %20.12f\n",V[1,1])
// now do whatever you want to do with b and V in Mata
// the results can be returned to Stata with the st_ functions
end

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
```
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
```   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```