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

From |
"Martin Weiss" <martin.weiss@uni-tuebingen.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Problem with outreg2 in a do file |

Date |
Sun, 10 Aug 2008 15:52:45 +0200 |

Let me take a first shot at this and say that results are usually returned as -return scalar- by a program. I bet your problem has something to do with the use of locals inside your program, and different handling of those in a do-file vs. interactive use. See -h simulate- at the bottom for an example of the -return scalar- command. Other listers will probably elaborate on this. HTH, Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Davide Cantoni Sent: Sunday, August 10, 2008 1:18 PM To: statalist@hsphsun2.harvard.edu Subject: st: Problem with outreg2 in a do file Hello, I have a problem with a certain -outreg2- line that does not work in a do-file, but works perfectly when called up manually. I really can't understand why that happens. Here's the program. What I am doing there is defining a program to test a nonlinear combination of coefficients (the long-run effect in a dynamic panel), and therefore I create "testlreff". There, I save the results (which are matrices) in scalars, so that I can use them in -outreg2, addstat()-. *** code begins here*** 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); end of do-file r(198); Now the weird thing is that if I now copy and paste that outreg2 line manually into stata, right after the do file stalls, it works perfectly. So I really can't understand why it does not work when it is in a do file. Thanks for any suggestions! Davide * * 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/

**Follow-Ups**:**st: RE: RE: Problem with outreg2 in a do file***From:*"Martin Weiss" <martin.weiss@uni-tuebingen.de>

**References**:**st: Problem with outreg2 in a do file***From:*"Davide Cantoni" <davide.cantoni@gmail.com>

- Prev by Date:
**Re: st: confidence interval for median** - Next by Date:
**Re: st: re: problem with outreg2 in a do file** - Previous by thread:
**st: Problem with outreg2 in a do file** - Next by thread:
**st: RE: 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 |