Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Table which indicates companies that are dividend payers across multiple years within a panel dataset

    Dear Statlist forum,

    I'm working with an unbalanced panel data set. I am trying to find the code that indicates, per each year, how many unique companies occur in the data set and also out of these companies, how many pay dividends. My dataset looks like the following:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double FiscalY str70 Company double Dividends
    2005 "AAR CORP"                            0
    2006 "AAR CORP"                            0
    2007 "AAR CORP"                            0
    2008 "AAR CORP"                            0
    2009 "AAR CORP"                            0
    2005 "ADC TELECOMMUNICATIONS INC"          0
    2006 "ADC TELECOMMUNICATIONS INC"          0
    2007 "ADC TELECOMMUNICATIONS INC"          0
    2008 "ADC TELECOMMUNICATIONS INC"          0
    2009 "ADC TELECOMMUNICATIONS INC"          0
    2005 "AFA PROTECTIVE SYSTEMS INC"          .
    2006 "AFA PROTECTIVE SYSTEMS INC"          .
    2007 "AFA PROTECTIVE SYSTEMS INC"       .307
    2008 "AFA PROTECTIVE SYSTEMS INC"      3.375
    2009 "AFA PROTECTIVE SYSTEMS INC"       .307
    2005 "AFP IMAGING CORP"                    0
    2006 "AFP IMAGING CORP"                    0
    2007 "AFP IMAGING CORP"                    0
    2008 "AFP IMAGING CORP"                    0
    2005 "ALPHARMA INC  -CL A"             9.481
    2006 "ALPHARMA INC  -CL A"             7.384
    2007 "ALPHARMA INC  -CL A"                 0
    2005 "AMERICAN AIRLINES GROUP INC"         0
    2006 "AMERICAN AIRLINES GROUP INC"         0
    2007 "AMERICAN AIRLINES GROUP INC"         0
    2008 "AMERICAN AIRLINES GROUP INC"         0
    2009 "AMERICAN AIRLINES GROUP INC"         0
    2005 "ANR PIPELINE CO"                     0
    2006 "ANR PIPELINE CO"                     0
    2005 "CECO ENVIRONMENTAL CORP"             0
    2006 "CECO ENVIRONMENTAL CORP"             0
    2007 "CECO ENVIRONMENTAL CORP"             0
    2008 "CECO ENVIRONMENTAL CORP"             0
    2009 "CECO ENVIRONMENTAL CORP"             0
    2005 "AEROFLEX INC"                        0
    2006 "AEROFLEX INC"                        0
    2005 "ASA GOLD AND PRECIOUS METALS"     8.64
    2005 "ASA GOLD AND PRECIOUS METALS"     8.64
    2006 "ASA GOLD AND PRECIOUS METALS"     8.64
    2006 "ASA GOLD AND PRECIOUS METALS"     8.64
    2007 "ASA GOLD AND PRECIOUS METALS"    22.08
    2007 "ASA GOLD AND PRECIOUS METALS"    22.08
    2008 "ASA GOLD AND PRECIOUS METALS"    15.12
    2008 "ASA GOLD AND PRECIOUS METALS"    15.12
    2009 "ASA GOLD AND PRECIOUS METALS"    9.144
    2009 "ASA GOLD AND PRECIOUS METALS"    9.144
    2005 "AVX CORP"                       25.862
    2006 "AVX CORP"                       25.819
    2007 "AVX CORP"                       27.466
    2008 "AVX CORP"                       27.316
    2009 "AVX CORP"                       27.242
    2005 "PINNACLE WEST CAPITAL CORP"    186.677
    2006 "PINNACLE WEST CAPITAL CORP"     201.22
    2007 "PINNACLE WEST CAPITAL CORP"    210.473
    2008 "PINNACLE WEST CAPITAL CORP"    211.405
    2009 "PINNACLE WEST CAPITAL CORP"    212.386
    2005 "PROG HOLDINGS INC"               2.693
    2006 "PROG HOLDINGS INC"               3.021
    2007 "PROG HOLDINGS INC"               3.307
    2008 "PROG HOLDINGS INC"               3.471
    2009 "PROG HOLDINGS INC"               3.739
    2005 "ABBOTT LABORATORIES"          1704.077
    2006 "ABBOTT LABORATORIES"          1807.829
    2007 "ABBOTT LABORATORIES"          2009.696
    2008 "ABBOTT LABORATORIES"          2228.776
    2009 "ABBOTT LABORATORIES"          2476.036
    2005 "SERVIDYNE INC"                    .512
    2006 "SERVIDYNE INC"                    .509
    2007 "SERVIDYNE INC"                    .509
    2008 "SERVIDYNE INC"                    .501
    2009 "SERVIDYNE INC"                    .185
    2005 "WORLDS INC"                          0
    2006 "WORLDS INC"                          0
    2007 "WORLDS INC"                          0
    2008 "WORLDS INC"                          0
    2009 "WORLDS INC"                          0
    2005 "ACETO CORP"                      3.641
    2006 "ACETO CORP"                      3.637
    2007 "ACETO CORP"                      4.257
    2008 "ACETO CORP"                      6.114
    2009 "ACETO CORP"                      4.957
    2005 "ACMAT CORP  -CL A"                   0
    2006 "ACMAT CORP  -CL A"                   0
    2007 "ACMAT CORP  -CL A"                   0
    2008 "ACMAT CORP  -CL A"                   0
    2009 "ACMAT CORP  -CL A"                   0
    2005 "ACME UNITED CORP"                 .425
    2006 "ACME UNITED CORP"                 .417
    2007 "ACME UNITED CORP"                 .565
    2008 "ACME UNITED CORP"                 .621
    2009 "ACME UNITED CORP"                 .653
    2005 "ALUF HOLDINGS INC"                   0
    2006 "ALUF HOLDINGS INC"                   0
    2007 "ALUF HOLDINGS INC"                   0
    2008 "ALUF HOLDINGS INC"                   0
    2005 "ACTIVISION INC"                      0
    2006 "ACTIVISION INC"                      0
    2007 "ACTIVISION INC"                      0
    2005 "BK TECHNOLOGIES CORP"                0
    2006 "BK TECHNOLOGIES CORP"                0
    end

    As you can see there are observations where dividends are equal to 0.

    So far I've tried running the following code to get the amount of companies that pay dividends in a given year:
    Code:
    gen DivPayer = 0 
    replace DivPayer = 1 if Dividends > 0
    tab FiscalY DivPayer
    However I don't believe that it yields me the correct results.

    I also don't know what code to come up with that would indicate the amount of unique companies per each year. I would really appreciate some input.

    Best regards,
    Viktor Christian

  • #2
    Code:
    distinct Company
    
    by FiscalY, sort: egen number_of_dividend_payers = total(Dividends > 0)
    tabstat number_of_dividend_payers, by(FiscalY)
    -distinct- is written by Gary Longton and Nick Cox and is available from SSC.

    Comment


    • #3
      Clyde Schechter Hi, thank you so much for the help it was exactly what I needed!

      Comment


      • #4
        Viktor Christian I note that your Dividends variable appears to have some missing values. To address this, I would suggest a small modification to the code in #2:

        Code:
        distinct Company
        
        by FiscalY, sort: egen number_of_dividend_payers = total(Dividends > 0 & !missing(Dividends))
        tabstat number_of_dividend_payers, by(FiscalY)

        Comment


        • #5
          Hemanshu Kumar Hi, thank you for the addition! I would like to ask how does this addition to the code decrease the number of dividend paying firms in a given year?

          Since we are now telling Stata to create the total number of firms per fiscal year, that have dividend values above 0 and firms that have missing values for dividends, shouldn't the number increase? I believe I'm miss-interpreting the code here.

          Comment


          • #6
            Viktor Christian no, the code is doing exactly the opposite of what you're thinking. You see in Stata, numeric missing values are treated a bit like positive infinity, so that when you do Dividends > 0, you will also end up including cases where Dividends is missing. On the other hand I specified !missing(Dividends), where the exclamation mark is the NOT operator.

            See also
            Code:
            help missing

            Comment


            • #7
              Hemanshu Kumar Hi, sorry for the late response but thank you very much for the explanation, it makes much more sense now and it greatly helped with my thesis.

              Comment

              Working...
              X