[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Kit Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: re: problem with outreg2 in a do file |

Date |
Sun, 10 Aug 2008 07:44:52 -0400 |

< >

Davide said

cap program drop testlreff

program testlreff

nlcom _b[L1.x]/(1-_b[L1.y])

mat b1=r(b)

mat v1=r(V)

local b=b1[1,1]

local se=sqrt(v1[1,1])

end

xtabond2 y L.(y x) yr* , gmm(L.(y)) iv(yr*) iv(L2.x, passthru) noleveleq robust

testlreff

outreg2 L1.y L1.x using whatever, bdec(3) br addstat(long-run effect,

`b', se, `se') replace

*** code ends here***

The problem that appears when I run this do file is that right after

the outreg-line Stata stops and tells me:

. outreg2 L1.y L1.x using whatever.xls, bdec(3) br addstat(lon

> g-run effect, `b', se, `se')

invalid syntax

r(198);

Your program testlreff does not return anything to the calling program. Items b and se are local to testlreff. This may work in interactive mode as you are defining locals that are then visible to the next command, but it will not when this routine is in a do-file. If you modify the last two lines to read

return local b = b[1,1]

return local se = sqrt(v1[1,1])

you then should have access to those objects, which will be known as r(b) and r(se). Also modify the program line to read

program testlreff, rclass

Kit Baum, Boston College Economics and DIW Berlin

http://ideas.repec.org/e/pba1.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/

**Follow-Ups**:**Re: st: re: problem with outreg2 in a do file***From:*"Davide Cantoni" <davide.cantoni@gmail.com>

- Prev by Date:
**st: Problem with outreg2 in a do file** - Next by Date:
**Re: st: confidence interval for median** - Previous by thread:
**st: Problem with outreg2 in a do file** - Next by thread:
**Re: st: re: problem with outreg2 in a do file** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |