Hi all,

I have the following table where I want to generate the variable "board_independence".

The variable should be calculated as follows.
E.g. for Agilent Technologies 2007 there are eight entries. Seven of them state "Yes" in the column "Independence" while one of them states "no". My goal is now that in the column"board_independence" the percentage of entries with "Yes" for each "year" and "name" combination is indicated. In the case for Agilent Technologies 2007 it would be 7/8, hence 87.5%.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double year str12 CUSIP str100 Name str3 Independence
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2007 "00846U101" "AGILENT TECHNOLOGIES INC."  "No" 
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "Yes"
2008 "00846U101" "AGILENT TECHNOLOGIES INC."  "No" 
2009 "00846U101" "AGILENT TECHNOLOGIES, INC." "Yes"
2009 "00846U101" "AGILENT TECHNOLOGIES, INC." "Yes"
2009 "00846U101" "AGILENT TECHNOLOGIES, INC." "Yes"
end
Thanks for your comments

Best

Matthias