Announcement

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

  • How to create big firm's sales share by year & industry

    Hi, I am trying the create a new variable called `big_firm_share`, which is computed as:

    the sum(sales of all big firms)/sum(sales of all firms) by year and industry together.

    Big firm is defined if lbg30 ==1, and industry variable is ksic1.

    I want to make sure if this is a correct way of doing so and how to complete the code. Thank you.

    Code:
    sort year ksic1
    by year ksic1 : egen big_firm_share= ....
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str6 firmid float(year lbg30 sales) str58 ksic1
    "000020" 1991 0   8.8382e+10 "manufacturing"                            
    "000020" 1992 0  1.02573e+11 "manufacturing"                            
    "000020" 1993 0  1.14395e+11 "manufacturing"                            
    "000020" 1994 0  1.19775e+11 "manufacturing"                            
    "000020" 1995 0  1.28408e+11 "manufacturing"                            
    "000020" 1996 0   1.3484e+11 "manufacturing"                            
    "000020" 1997 0  1.43815e+11 "manufacturing"                            
    "000020" 1998 0  1.41186e+11 "manufacturing"                            
    "000020" 1999 0  1.36299e+11 "manufacturing"                            
    "000020" 2000 0   1.3823e+11 "manufacturing"                            
    "000020" 2001 0  1.26424e+11 "manufacturing"                            
    "000020" 2002 0  1.34147e+11 "manufacturing"                            
    "000020" 2003 0  1.34383e+11 "manufacturing"                            
    "000020" 2004 0  1.23012e+11 "manufacturing"                            
    "000020" 2005 0  1.37962e+11 "manufacturing"                            
    "000020" 2006 0  1.52822e+11 "manufacturing"                            
    "000020" 2007 0  1.48739e+11 "manufacturing"                            
    "000020" 2008 0   1.7512e+11 "manufacturing"                            
    "000020" 2009 0  1.88608e+11 "manufacturing"                            
    "000020" 2010 0  2.15279e+11 "manufacturing"                            
    "000040" 1991 0   8.7739e+10 "manufacturing"                            
    "000040" 1992 0    9.399e+10 "manufacturing"                            
    "000040" 1993 0   8.4703e+10 "manufacturing"                            
    "000040" 1994 0   6.8227e+10 "manufacturing"                            
    "000040" 1995 0   5.4498e+10 "manufacturing"                            
    "000040" 1996 0  1.72138e+11 "manufacturing"                            
    "000040" 1998 0   8.4769e+10 "manufacturing"                            
    "000040" 2001 0  1.00538e+11 "manufacturing"                            
    "000040" 2002 0   9.2186e+10 "manufacturing"                            
    "000040" 2003 0   7.9167e+10 "manufacturing"                            
    "000040" 2005 0  1.07786e+11 "manufacturing"                            
    "000040" 2006 0  1.13905e+11 "manufacturing"                            
    "000040" 2007 0  1.33963e+11 "manufacturing"                            
    "000040" 2008 0  1.14734e+11 "manufacturing"                            
    "000040" 2010 0  1.44521e+11 "manufacturing"                            
    "000050" 1991 0  1.16072e+11 "retail"                  
    "000050" 1992 0  1.16114e+11 "retail"                  
    "000050" 1993 0  1.15466e+11 "retail"                  
    "000050" 1994 0  1.50682e+11 "retail"                  
    "000050" 1995 0  1.78967e+11 "retail"                  
    "000050" 1996 0  1.76528e+11 "retail"                  
    "000050" 1997 0  1.93152e+11 "retail"                  
    "000050" 1998 0   2.2036e+11 "retail"                  
    "000050" 1999 0  2.15739e+11 "retail"                  
    "000050" 2000 0  1.72513e+11 "retail"                  
    "000050" 2001 0  1.78381e+11 "retail"                  
    "000050" 2002 0  1.91323e+11 "retail"                  
    "000050" 2003 0  1.85753e+11 "retail"                  
    "000050" 2004 0  1.73897e+11 "retail"                  
    "000050" 2005 0  1.63968e+11 "retail"                  
    "000050" 2007 0  1.52194e+11 "retail"                  
    "000050" 2009 0  1.77298e+11 "retail"                  
    "000050" 2010 0  2.72271e+11 "retail"                  
    "000070" 1991 0  6.52292e+11 "service"
    "000070" 1992 0  6.98666e+11 "service"
    "000070" 1993 0  7.24981e+11 "service"
    "000070" 1994 0  7.69685e+11 "service"
    "000070" 1995 0 1.117635e+12 "service"
    "000070" 1996 0 1.144018e+12 "service"
    "000070" 1997 0 1.128696e+12 "service"
    "000070" 1998 0 1.368467e+12 "service"
    "000070" 1999 1 1.206235e+12 "service"
    "000070" 2000 0  1.20507e+12 "service"
    "000070" 2001 0  9.33729e+11 "service"
    "000070" 2002 0  7.79117e+11 "service"
    "000070" 2003 0    7.877e+11 "service"
    "000070" 2004 0  8.90163e+11 "service"
    "000070" 2005 0  9.84375e+11 "service"
    "000070" 2006 0  1.17002e+12 "service"
    "000070" 2007 0 1.145461e+12 "service"
    "000070" 2008 0 1.308486e+12 "service"
    "000070" 2009 0 1.495948e+12 "service"
    "000070" 2010 0 1.665497e+12 "service"
    "000080" 1991 1  1.91285e+11 "manufacturing"                            
    "000080" 1992 1  2.17408e+11 "manufacturing"                            
    "000080" 1993 1  2.55228e+11 "manufacturing"                            
    "000080" 1994 1  3.02197e+11 "manufacturing"                            
    "000080" 1995 1  4.11659e+11 "manufacturing"                            
    "000080" 1996 1  4.36697e+11 "manufacturing"                            
    "000080" 1997 1  4.89055e+11 "manufacturing"                            
    "000080" 1998 1  4.62326e+11 "manufacturing"                            
    "000080" 1999 1   5.1305e+11 "manufacturing"                            
    "000080" 2000 1  5.21251e+11 "manufacturing"                            
    "000080" 2001 0  5.47127e+11 "manufacturing"                            
    "000080" 2002 0  5.90404e+11 "manufacturing"                            
    "000080" 2009 0  6.81861e+11 "manufacturing"                            
    "000080" 2010 0  7.05579e+11 "manufacturing"                            
    "000100" 1991 0   1.1015e+11 "manufacturing"                            
    "000100" 1992 0  1.27698e+11 "manufacturing"                            
    "000100" 1993 0  1.36927e+11 "manufacturing"                            
    "000100" 1994 0  1.48019e+11 "manufacturing"                            
    "000100" 1995 0  1.68781e+11 "manufacturing"                            
    "000100" 1996 0  1.88294e+11 "manufacturing"                            
    "000100" 1997 0    2.029e+11 "manufacturing"                            
    "000100" 1998 0   2.0052e+11 "manufacturing"                            
    "000100" 1999 0  1.88452e+11 "manufacturing"                            
    "000100" 2000 0  2.20495e+11 "manufacturing"                            
    "000100" 2001 0   2.5899e+11 "manufacturing"                            
    "000100" 2002 0  2.84982e+11 "manufacturing"                            
    "000100" 2003 0  3.06596e+11 "manufacturing"                            
    end

  • #2
    You've created a set for the movie. You just need some actors. Consider

    Code:
    egen double numer = total(lbg30 * sales), by(ksic1 year)
    egen double denom = total(sales), by(ksic1 year)
    and then it should be clear what to do next.

    Comment


    • #3
      Nick Cox thanks for your answers and important points. Using those codes, I want to figure out two things: which industry has high dominance of big firm in terms of sales and then regress on big firm share by controlling other covariates. Then is the next step should be like the following?

      Code:
       egen big_firm_share = numer/denom
      Or alternatively, how about doing without by industry option and then later consider them by industry, like the following?

      Code:
      egen double numer = total(lbg30 * sales), by(year)
      egen double denom = total(sales), by(year)
      egen big_firm_share = numer/denom
      sort big_firm_share, by(ksic1)
      Last edited by Chul-Kyoo Jung; 23 Dec 2021, 07:13.

      Comment


      • #4
        Your sort command is illegal. but otherwise it's up to you. Different questions have different answers.

        Comment

        Working...
        X