Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: RE: create local from element of matrix e(b)

 From "Claire Kamp Dush" To , Subject RE: st: RE: create local from element of matrix e(b) Date Thu, 14 Oct 2010 13:47:39 -0400

```Thanks again all - I love the statalist, and those of you who continually monitor it are so kind. I was just saved many hand calculations. Thanks!

________________________________

From: owner-statalist@hsphsun2.harvard.edu on behalf of Nick Cox
Sent: Thu 10/14/2010 1:39 PM
To: 'statalist@hsphsun2.harvard.edu'
Subject: RE: st: RE: create local from element of matrix e(b)

Yes, good point, and I really should have remembered that.

Nick
n.j.cox@durham.ac.uk

Steve Samuels

This "feature" of e(b) is a continuing irritant, but in this case why not:

local bw = _b[wavedi]

On Thu, Oct 14, 2010 at 1:17 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> I know of a two-line solution
>
> mat b = e(b)
> local bw = b[1,1]
>
> and I too would be interested to hear of a shorter one.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Claire Kamp Dush
>
> I am sure someone had to have asked this type of question before, but in my googling and searching of the statalist archive, I could not come across a clear answer.
>
> I am trying to create a local that equals an element of matrix e(b) produced by Stata following xtreg, fe. In fact, I am trying to get the first element.
>
> Here is what I did:
>
> quietly xtreg mdepc wavedi mdis_coh, fe
> . matrix list e(b)
> e(b)[1,3]
>       wavedi   mdis_coh      _cons
> y1  .24873096  .34650713  .83985765
>
> . local dif = el(e(b), 1,1)
> matrix operators that return matrices not allowed in this context
> r(509);
> . local dif = e(b)[1,1]
> invalid syntax
> r(198);
> . gen dif = el(e(b), 1,1)
> matrix operators that return matrices not allowed in this context
> r(509);
> . gen dif = e(b)[1,1]
> matrix operators that return matrices not allowed in this context
> r(509);
>
>
> I would appreciate any advice - I am sure I am making a really obvious mistake.
>

*
*   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/

*
*   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/
```