Announcement

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

  • #16
    I was not aware of that. Thanks for bringing me up to date on that.

    Comment


    • #17
      I think I found a simple solution for your problem. It fist loads the first_date of one fund in a temporary column for the entire firm to check it with the investment dates. It saves the number of times that the investment date is smaller than the first date in the variable counter. If something is unclear, I'm happy to explain it to you on the third floor!

      Code:
      gen counter = .
      by firmname fundname,sort:  gen id = 1 if _n == 1
      by firmname: replace id = sum(id)
      egen maxid = max(id)
      
      forvalues i = 1(1)`=maxid' {
          gen comp = first_idate if id == `i'
          by firmname: egen meancomp = mean(comp)
          gen higher = 1 if meancomp > idate & meancomp != .
          by firmname: gen sumhigher = sum(higher)
          by firmname: replace sumhigher = sumhigher[_N]
          replace counter = sumhigh if meancomp == first_idate
          drop meancomp sumhigher higher comp
          
      }

      Comment

      Working...
      X