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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Muhammad Ramzan <[email protected]> |

To |
[email protected] |

Subject |
Re: st: Forreach loop with esttab |

Date |
Tue, 14 Jan 2014 14:39:25 +0500 |

Thanks a lot Eric, its working fine . there was issue of ". Thanks MUHAMMAD RAMZAN On 13 January 2014 23:02, Eric Booth <[email protected]> wrote: > <> > > As Nick mentioned, -parmest- is from SSC. > > The error on umatched quotes is definitely a copy/paste issue. I just pasted my example into the do-file editor from a browser based email client and it gave the same error — I pasted it as raw/unformatted text and it ran fine. If you look at the double quotes in that line in the do-file editor you will see that they are not straight double quotes , the last set is slanted (paired double quotes) (that’s what Nick is getting at here with the ascii code). > > Finally, regarding Nick’s comment abou the local adding the _b’s, I included that because that’s what the OP asked for — I’m not sure about the wisdom of it (or if it’s some sort of simplified example of something else he wants to do in an estimates table) but it reproduces what he said he wants. > > Hope this helps, > Eric > [email protected] > > > On Jan 13, 2014, at 11:39 AM, Nick Cox <[email protected]> wrote: > >> Working backwards: >> >> 2. -parmest- (SJ, SSC etc.) is a user-written command. You must >> install it before trying to run it. Eric Booth did explain that it is >> user-written, by giving a reference to SSC. >> >> 1. The error about unmatched quotes probably arises from the line >> >> global storelist = "${storelist} `yvar'1” >> >> Look again at your double quotation marks. You need to match the first >> quotation mark with the same character, ASCII 34. >> >> 0. The line >> >> local `yvar'1 = _b[foreign]+_b[weight] >> >> looks like a major bug. I see little point to adding those coefficients. >> >> Nick >> [email protected] >> >> >> On 13 January 2014 17:27, Muhammad Ramzan <[email protected]> wrote: >>> Thanks a lot Eric For your reply >>> >>> I have run your both codes. >>> in the first code i am getting the following error message >>> >>> **using Roberto’s example here: >>> . foreach yvar of varlist mpg price displacement { >>> 2. regress `yvar' foreign weight >>> 3. global `yvar'1 = _b[foreign]+_b[weight] >>> 4. eststo `yvar'1 >>> 5. global storelist = "${storelist} `yvar'1” >>> 6. } >>> >>> Source | SS df MS Number of obs = 74 >>> -------------+------------------------------ F( 2, 71) = 69.75 >>> Model | 1619.2877 2 809.643849 Prob > F = 0.0000 >>> Residual | 824.171761 71 11.608053 R-squared = 0.6627 >>> -------------+------------------------------ Adj R-squared = 0.6532 >>> Total | 2443.45946 73 33.4720474 Root MSE = 3.4071 >>> >>> ------------------------------------------------------------------------------ >>> mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval] >>> -------------+---------------------------------------------------------------- >>> foreign | -1.650029 1.075994 -1.53 0.130 -3.7955 .4954422 >>> weight | -.0065879 .0006371 -10.34 0.000 -.0078583 -.0053175 >>> _cons | 41.6797 2.165547 19.25 0.000 37.36172 45.99768 >>> ------------------------------------------------------------------------------ >>> too few quotes >>> r(132); >>> >>> in the second >>> . sysuse auto, clear >>> (1978 Automobile Data) >>> >>> . >>> . foreach yvar of varlist mpg price displacement { >>> 2. regress `yvar' foreign weight >>> 3. local `yvar'1 = _b[foreign]+_b[weight] >>> 4. estimates store `yvar'1 >>> 5. local storelist = "`storelist' `yvar'1" >>> 6. parmest, label sav(test.dta, replace) >>> 7. preserve >>> 8. u test.dta, clear >>> 9. keep label estimate stderr >>> 10. rename estimate e1 >>> 11. rename stderr e2 >>> 12. g i = _n >>> 13. reshape long e , i(i) j(j) >>> 14. replace label = "" if j ==2 >>> 15. drop i j >>> 16. set obs `=_N+1' >>> 17. replace e = ``yvar'1' in l >>> 18. replace label = "a" in l >>> 19. g n = _n >>> 20. rename e `yvar' >>> 21. sa `yvar'1, replace >>> 22. restore >>> 23. } >>> >>> Source | SS df MS Number of obs = 74 >>> -------------+------------------------------ F( 2, 71) = 69.75 >>> Model | 1619.2877 2 809.643849 Prob > F = 0.0000 >>> Residual | 824.171761 71 11.608053 R-squared = 0.6627 >>> -------------+------------------------------ Adj R-squared = 0.6532 >>> Total | 2443.45946 73 33.4720474 Root MSE = 3.4071 >>> >>> ------------------------------------------------------------------------------ >>> mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval] >>> -------------+---------------------------------------------------------------- >>> foreign | -1.650029 1.075994 -1.53 0.130 -3.7955 .4954422 >>> weight | -.0065879 .0006371 -10.34 0.000 -.0078583 -.0053175 >>> _cons | 41.6797 2.165547 19.25 0.000 37.36172 45.99768 >>> ------------------------------------------------------------------------------ >>> unrecognized command: parmest >>> r(199); >>> >>> >>> Regards >>> MUHAMMAD RAMZAN >>> >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ -- Assalam-o-Alaikum Muhammad Ramzan Lecturer (Economics) Pakistan Institute of Development Economics Islamabad * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Forreach loop with esttab***From:*Muhammad Ramzan <[email protected]>

**Re: st: Forreach loop with esttab***From:*Roberto Ferrer <[email protected]>

**Re: st: Forreach loop with esttab***From:*Muhammad Ramzan <[email protected]>

**Re: st: Forreach loop with esttab***From:*Eric Booth <[email protected]>

**Re: st: Forreach loop with esttab***From:*Muhammad Ramzan <[email protected]>

**Re: st: Forreach loop with esttab***From:*Nick Cox <[email protected]>

**Re: st: Forreach loop with esttab***From:*Eric Booth <[email protected]>

- Prev by Date:
**Re: st: Replacing the values of time indicator in Panel data** - Next by Date:
**Re: st: Replacing the values of time indicator in Panel data** - Previous by thread:
**Re: st: Forreach loop with esttab** - Next by thread:
**Re: st: Forreach loop with esttab** - Index(es):