I am trying to create dummy variable based on conditions met in each the year - I will have two variables one is "Compliance 1" and "Compliance 2". I have tried looking into several forum posts and elsewhere but could't come up with the code to match my requirement

- The condition of Compliance 1 will include ONLY firms/tickers that has independent directors (INBD) greater than or equal to 3 is each year for the entire sample period
- The condition of Compliance 2 will include firms that has independent directors (INBD) greater or equal to 3 in any year after 1999 - but will exclude firms not included in COMPLIANCE 1

Later, I plan to use these two variables to create the dummy variable. The reason I am doing this to do t-test to test the significance in means for each group

Any help would or clue towards establishing this would be great. Thank you in advance


Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str9 Ticker int Year byte INBD
"TH:2S"     1995 4
"TH:2S"     1996 2
"TH:2S"     1997 4
"TH:2S"     1998 3
"TH:2S"     1999 5
"TH:2S"     2000 4
"TH:2S"     2001 3
"TH:2S"     2002 3
"TH:2S"     2003 3
"TH:A"      1995 5
"TH:A"      1996 5
"TH:A"      1997 0
"TH:A"      1998 3
"TH:A"      1999 2
"TH:A"      2000 4
"TH:A"      2001 8
"TH:A"      2002 3
"TH:A"      2003 4
"TH:AA"     1995 5
"TH:AA"     1996 0
"TH:AA"     1997 3
"TH:AA"     1998 5
"TH:AA"     1999 3
"TH:AA"     2000 7
"TH:AA"     2001 2
"TH:AA"     2002 5
"TH:AA"     2003 6
"TH:AAV"    1995 3
"TH:AAV"    1996 3
"TH:AAV"    1997 4
"TH:AAV"    1998 0
"TH:AAV"    1999 0
"TH:AAV"    2000 7
"TH:AAV"    2001 0
"TH:AAV"    2002 3
"TH:AAV"    2003 0
"TH:ABICO"  1995 4
"TH:ABICO"  1996 4
"TH:ABICO"  1997 3
"TH:ABICO"  1998 4
"TH:ABICO"  1999 3
"TH:ABICO"  2000 1
"TH:ABICO"  2001 3
"TH:ABICO"  2002 4
"TH:ABICO"  2003 0
"TH:ACC"    1995 3
"TH:ACC"    1996 3
"TH:ACC"    1997 2
"TH:ACC"    1998 3
"TH:ACC"    1999 3
"TH:ACC"    2000 0
"TH:ACC"    2001 4
"TH:ACC"    2002 4
"TH:ACC"    2003 1
"TH:ADVANC" 1995 3
"TH:ADVANC" 1996 4
"TH:ADVANC" 1997 4
"TH:ADVANC" 1998 4
"TH:ADVANC" 1999 0
"TH:ADVANC" 2000 0
"TH:ADVANC" 2001 2
"TH:ADVANC" 2002 3
"TH:ADVANC" 2003 3
"TH:AFC"    1995 3
"TH:AFC"    1996 0
"TH:AFC"    1997 3
"TH:AFC"    1998 2
"TH:AFC"    1999 3
"TH:AFC"    2000 1
"TH:AFC"    2001 4
"TH:AFC"    2002 3
"TH:AFC"    2003 2
"TH:AGE"    1995 0
"TH:AGE"    1996 2
"TH:AGE"    1997 0
"TH:AGE"    1998 2
"TH:AGE"    1999 3
"TH:AGE"    2000 4
"TH:AGE"    2001 3
"TH:AGE"    2002 5
"TH:AGE"    2003 3
"TH:AH"     1995 3
"TH:AH"     1996 4
"TH:AH"     1997 7
"TH:AH"     1998 4
"TH:AH"     1999 0
"TH:AH"     2000 3
"TH:AH"     2001 2
"TH:AH"     2002 2
"TH:AH"     2003 3
"TH:AHC"    1995 4
"TH:AHC"    1996 3
"TH:AHC"    1997 2
"TH:AHC"    1998 4
"TH:AHC"    1999 4
"TH:AHC"    2000 0
"TH:AHC"    2001 4
"TH:AHC"    2002 2
"TH:AHC"    2003 4
"TH:AI"     1995 2
end
format %ty Year