I am trying to do t-test where I have three groups (AIC, GIC, Others) - accordingly I created a variable (Test1) which is equal to 1 if AIC and 2 if GIC and 3 if Others. However, when I run t-test I can see it only takes two groups.

Is there is any way I can do three groups by Ticker and by Year ?

Any advice would be highly helpful


Code:
 ttest DA_w, by(Test1) unequal welch

Two-sample t test with unequal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       1 |   1,105    .0142281    .0045872    .1524843    .0052275    .0232286
       2 |   2,515    -.006903     .003283    .1646403   -.0133406   -.0004654
---------+--------------------------------------------------------------------
Combined |   3,620   -.0004528    .0026809       .1613    -.005709    .0048035
---------+--------------------------------------------------------------------
    diff |             .021131    .0056409                .0100691    .0321929
------------------------------------------------------------------------------
    diff = mean(1) - mean(2)                                      t =   3.7460
H0: diff = 0                             Welch's degrees of freedom =  2265.65

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9999         Pr(|T| > |t|) = 0.0002          Pr(T > t) = 0.0001
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str9 Ticker int Year byte(AIC GIC Others) float(Test1 DA_w)
"TH:2S"    2003 . 1 . 2           .
"TH:2S"    2004 . 1 . 2           .
"TH:2S"    2005 . 1 . 2           .
"TH:2S"    2006 . 1 . 2           .
"TH:2S"    2007 . 1 . 2  -.08454061
"TH:2S"    2008 . 1 . 2  -.25864583
"TH:2S"    2009 . 1 . 2    .6085715
"TH:2S"    2010 . 1 . 2   .09650405
"TH:2S"    2011 . 1 . 2   -.1017216
"TH:2S"    2012 . 1 . 2   .11378127
"TH:2S"    2013 . 1 . 2  -.05965737
"TH:2S"    2014 . 1 . 2  -.04307863
"TH:A"     2003 1 . . 1           .
"TH:A"     2004 1 . . 1    .6278349
"TH:A"     2005 1 . . 1   .06726224
"TH:A"     2006 1 . . 1   -.1024842
"TH:A"     2007 1 . . 1   .09083974
"TH:A"     2008 1 . . 1  -.02267651
"TH:A"     2009 1 . . 1  -.15725097
"TH:A"     2010 1 . . 1    .0957468
"TH:A"     2011 1 . . 1  .032091457
"TH:A"     2012 1 . . 1    .1184249
"TH:A"     2013 1 . . 1    .2663026
"TH:A"     2014 1 . . 1    .2288631
"TH:ABICO" 2003 . 1 . 2   -.1509448
"TH:ABICO" 2004 . 1 . 2   -.7443731
"TH:ABICO" 2005 . 1 . 2    .6278349
"TH:ABICO" 2006 . 1 . 2 -.013820863
"TH:ABICO" 2007 . 1 . 2  .066848315
"TH:ABICO" 2008 . 1 . 2   -.1630021
"TH:ABICO" 2009 . 1 . 2    .1760944
"TH:ABICO" 2010 . 1 . 2  .027172344
"TH:ABICO" 2011 . 1 . 2    .1821229
"TH:ABICO" 2012 . 1 . 2    .2805742
"TH:ABICO" 2013 . 1 . 2   .04285799
"TH:ABICO" 2014 . 1 . 2   .06678031
"TH:ACC"   2003 . 1 . 2   .13844515
"TH:ACC"   2004 . 1 . 2  -.23043732
"TH:ACC"   2005 . 1 . 2   -.1565992
"TH:ACC"   2006 . 1 . 2  -.09132891
"TH:ACC"   2007 . 1 . 2   .04345912
"TH:ACC"   2008 . 1 . 2   .18008757
"TH:ACC"   2009 . 1 . 2           .
"TH:ACC"   2010 . 1 . 2           .
"TH:ACC"   2011 . 1 . 2     .213304
"TH:ACC"   2012 . 1 . 2   .05535654
"TH:ACC"   2013 . 1 . 2  -.17010236
"TH:ACC"   2014 . 1 . 2           .
"TH:AFC"   2003 . 1 . 2   .04718301
"TH:AFC"   2004 . 1 . 2   .05981214
"TH:AFC"   2005 . 1 . 2   .23442598
"TH:AFC"   2006 . 1 . 2   -.1069364
"TH:AFC"   2007 . 1 . 2  -.04298536
"TH:AFC"   2008 . 1 . 2   .05517821
"TH:AFC"   2009 . 1 . 2 -.006168552
"TH:AFC"   2010 . 1 . 2   .01499469
"TH:AFC"   2011 . 1 . 2  .012949838
"TH:AFC"   2012 . 1 . 2   .04469505
"TH:AFC"   2013 . 1 . 2   .05154819
"TH:AFC"   2014 . 1 . 2           .
"TH:AGE"   2003 . 1 . 2           .
"TH:AGE"   2004 . 1 . 2           .
"TH:AGE"   2005 . 1 . 2           .
"TH:AGE"   2006 . 1 . 2           .
"TH:AGE"   2007 . 1 . 2           .
"TH:AGE"   2008 . 1 . 2   .26367554
"TH:AGE"   2009 . 1 . 2   .08931428
"TH:AGE"   2010 . 1 . 2   .25956905
"TH:AGE"   2011 . 1 . 2  -.09252103
"TH:AGE"   2012 . 1 . 2   .04484579
"TH:AGE"   2013 . 1 . 2   .13395208
"TH:AGE"   2014 . 1 . 2  -.27340496
"TH:AH"    2003 1 . . 1   -.2078416
"TH:AH"    2004 1 . . 1   -.1830832
"TH:AH"    2005 1 . . 1 .0010229541
"TH:AH"    2006 1 . . 1  .016149808
"TH:AH"    2007 1 . . 1   -.0128961
"TH:AH"    2008 1 . . 1  -.04499222
"TH:AH"    2009 1 . . 1   -.0351702
"TH:AH"    2010 1 . . 1  -.04360331
"TH:AH"    2011 1 . . 1 -.005175362
"TH:AH"    2012 1 . . 1  .030353934
"TH:AH"    2013 1 . . 1  -.05105714
"TH:AH"    2014 1 . . 1  -.07181978
"TH:AHC"   2003 . 1 . 2  -.04777425
"TH:AHC"   2004 . 1 . 2 -.019984696
"TH:AHC"   2005 . 1 . 2   .04643552
"TH:AHC"   2006 . 1 . 2 -.003667239
"TH:AHC"   2007 . 1 . 2   .01884266
"TH:AHC"   2008 . 1 . 2  -.01925189
"TH:AHC"   2009 . 1 . 2  .027770244
"TH:AHC"   2010 . 1 . 2 -.013661582
"TH:AHC"   2011 . 1 . 2  -.03151839
"TH:AHC"   2012 . 1 . 2  -.02424605
"TH:AHC"   2013 . 1 . 2   .02805965
"TH:AHC"   2014 . 1 . 2  .018061165
"TH:AI"    2003 . 1 . 2  .072685905
"TH:AI"    2004 . 1 . 2  -.10123187
"TH:AI"    2005 . 1 . 2  .012330643
"TH:AI"    2006 . 1 . 2   .04343369
end