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

From |
"Austin Nichols" <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Computing GDP growth using a log-linear regression |

Date |
Mon, 21 Jul 2008 10:51:20 -0400 |

D Harwood <bus4dpah@leeds.ac.uk>: Take the double quotes off =="`var'" is the short answer--you can't compare a number to a quoted string. But are you sure you want the avg change computed over all years (i.e. the trend, not the annual GDP growth rates)? And there is no need to generate yearcounter that I can see... On Mon, Jul 21, 2008 at 10:41 AM, D Harwood <bus4dpah@leeds.ac.uk> wrote: > Dear All, > > I was wondering if anyone knew how to compute GDP growth rates by country. I > have panel data arranged as follows: > > Country Year GDP ($ 2000) > Benin 1997 1947193088 > Benin 1998 2035610240 > Benin 1999 2131227520 > Benin 2000 2254838784 > Benin 2001 2367580672 > Benin 2002 2474121728 > Benin 2003 2570612480 > Benin 2004 2650301440 > Benin 2005 2727160320 > . > . > . > > And so on for a number of countries. Arranged by country code and by year. > > I found an example in the archives of how to calculate the growth rates > (http://www.stata.com/statalist/archive/2006-05/msg00529.html) and yet when > I try to do the same I get an error message 'Type mismatch', no matter which > variable type I enter. I typed the following into the command box and came > out with the output shown. > > . egen minyearbycountry = min(year), by(code) > r; t=0.00 15:30:23 > > . gen yearcounter = year-minyearbycountry > r; t=0.01 15:30:31 > > . gen g = . > (288 missing values generated) > r; t=0.00 15:30:39 > > . levelsof code > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > 29 30 31 32 > r; t=0.01 15:30:48 > > . foreach var in `r(levels)' { > 2. reg lnGDP yearcounter if code =="`var'" > 3. replace g = _b[yearcounter] if code =="`var'" > 4. } > type mismatch > r(109); t=26.93 15:31:23 > > I would be grateful if anyone could point out where I have gone wrong? > > Regards, > > Dave * * 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: Computing GDP growth using a log-linear regression***From:*D Harwood <bus4dpah@leeds.ac.uk>

**References**:**st: Computing GDP growth using a log-linear regression***From:*D Harwood <bus4dpah@leeds.ac.uk>

- Prev by Date:
**st: automatically label interaction terms** - Next by Date:
**Re: st: automatically label interaction terms** - Previous by thread:
**st: Computing GDP growth using a log-linear regression** - Next by thread:
**Re: st: Computing GDP growth using a log-linear regression** - Index(es):

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