Bookmark and Share

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

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

Re: st: growth rate

From   Nick Cox <>
Subject   Re: st: growth rate
Date   Wed, 10 Oct 2012 14:42:34 +0100

Given the irregularity in your data, time series operators cannot help
you here.

But there is a naturally a way to do what you can.

bysort id (year) : gen growth = (loggdp - loggdp[_n-1]) / (year - year[_n-1])

is I believe what you are seeking.

On Wed, Oct 10, 2012 at 2:24 PM, Lynn Lee <> wrote:

> My panel data has 4 years for each country,2007,2002,1997,1995. The gap is
> not same. Therefore, I do not know how to assign value to -delta()- in
> -xtset-. I figured out why  Stata11 generated all missing values for growth
> rate. But the year gap is unbalanced. I tried -xtset id year,delta(5)-,
> Stata11 told me "time values with period less than delta() found.
> Now, I replace "1995" with "1992" artificially, then I got the growth rate.
> But is there any direct way (not need to replace the year artificially)
> which can generates growth rate for unbalanced year gap panel data?

Nick Cox

> -help xtset- explains about setting by panel and year. Once you have done
> that correctly
> gen growth=D.loggdp
> is sufficient.

On Wed, Oct 10, 2012 at 1:41 PM, Lynn Lee <> wrote:

>> I use -bysort id: gen growth=D.loggdp- to generate growth rate of GDP
>> in panel data. I also wrote -xtset year- before this command, but
>> Stata11 told me "time variable not set". I am assuming this command
>> is only for time-series data. What about panel? What is the command
>> used in panel to generate growth rate?
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index