I got a list of companies and directors, whereby the directors are of different type. For each director type, I would like to calculate the number of directors per company per year.
I´ve done it but the problem is now with missing values. In the dataset below total_type_E counts the number of directors with type E, but only for the lines where the director is of type E. I want this number in every line for that company for that year. So from line 1 to 8, the column total_typeE should be 3.
Do you have any ideas?
Code:
clear input float year long permno double didown float(count_dir total_dir) str5 dir_type float(count_typE total_typE indep) 1996 10016 4336600 1 8 "E" 1 3 0 1996 10016 3241 2 8 "E" 2 3 0 1996 10016 4336700 3 8 "E" 3 3 0 1996 10016 4001200 4 8 "I" . . 1 1996 10016 20037900 5 8 "I" . . 1 1996 10016 4336900 6 8 "I" . . 1 1996 10016 3489000 7 8 "L" . . 0 1996 10016 4337000 8 8 "L" . . 0 end
0 Response to Replace missing counts with existing counts within a column
Post a Comment