I was not aware of that. Thanks for bringing me up to date on that.
-
Login or Register
- Log in with
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