Announcement

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

  • How to remove growth rate for observations when they do not exist

    I have data that is a longer version of thethe following:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str1(Lender Borrower) float(Year Amount)
    "A" "B" 1979  1000
    "A" "B" 1980 10000
    "A" "B" 1981 20000
    "A" "B" 1982 23444
    end

    Here, A is a lender and B is the borrower (there are many more lenders and borrowers). Here A lends B Amount X in year Y. I have been able to declare my data set as a panel, and am in the process of calculating growth rates of the amount of the loan. This would involve first differencing, dividing by the value at the beginning and multiplying by 100. However, for many individuals, they do not borrow an amount in year 1 but do in year 2. Of course, the growth rate is infinite. I do not know how to deal with such observations (probably should be deleted as the growth rate does not exist). Any help is much appreciated.

  • #2
    I think to get what you want you just have to add -if year == year[_n-1] + 1- to whatever command you are using to calculate the growth rate.

    Comment


    • #3
      Thanks a lot!

      Comment

      Working...
      X