Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • calculate growth rate in panel data with time series

    Hi,

    i have a panel data with country names, country ID, years etc
    i need to compute growth rate of a variable let say X. in order to do so i first computed this variable X. then i changed it to log form by

    gen l_X= ln(X)

    then when i tried to get growth rate i used

    gen grw_X= l_X - l_X[_n-1]

    it works but when i analysed outcome i noticed that time series are not accounted and when i have panel data with years lets say 2000-2010 and multiple different countries with different years, those years are inconsistent for ex. and when growth rate is calculated there is a significant change from end of last year in USA and first year in China as the formula computes previous year of different country and not start from a country year one, it just taking into consideration previous without accounting that it is different country already. I hope that makes sense.

    year country

    2000 usa
    2001 usa
    2002 usa
    2003 usa
    2004 usa
    2005 usa
    2000 china
    2001 china
    2002 china
    2003 china
    2000 india
    .
    .
    .

    i would be most grateful if someone could help with this problem, thanks in advance

  • #2
    https://www.statalist.org/forums/for...out-if-command covers the question you have. (May not seem so from the thread title, but I think it does.)

    Comment


    • #3
      thank you so much Nick Cox

      Comment

      Working...
      X