Announcement

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

  • Analyse data by groups

    Dear STATA users,

    From my thesis advisor I got the feedback: Try to analyze the data of cash compensation and show some trend in time, in industry.

    Therefore I thought I create groups and then show summary statistics per group.
    Code:
    tabstat Severancepayment, statistics(mean median) by(sub_sectors)
    However when creating the sub_sectors I get
    Code:
    too many variables specified
    I used the following commands to create the sub_sectors:
    Code:
    tostring StandardIndustryClassification, gen(sicIndustry) format(%04.0f)
    gen sic = substr(sicIndustry,-4,2)
    egen sub_sectors=group(sic)
    sort  sub_sectors
    
    gen Argicultural_Forestry_Fishing=(sub_sectors==1)
    gen Mining=(sub_sectors==2 &  sub_sectors==3 & sub_sectors==21)
    gen Manufacturing=(sub_sectors>=4 &  sub_sectors<=20)
    gen Wholesale_trade=(sub_sectors==22 &  sub_sectors==23)
    gen Retail_trade=(sub_sectors>=24 & sub_sectors<=27)
    gen Finance_Insurance_Real estate=(sub_sectors==28)
    gen Services=(sub_sectors=>29 & sub_sectors<=35)
    Can anyone explain me why I get "too many variables specified" or the quickest/best way to analyse compensation per year and per industry.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int YearMatch str4 Year int StandardIndustryClassification double(Salary Bonus Severancepayment)
    2000 "2000" 2834  765.769      775           4622.307
    2004 "2004" 7389  433.138  240.903                  0
    2003 "2003" 3661  451.731  495.789            2842.56
    1998 "1998" 2834      395      230                  0
    2002 "2002" 3663      517      114                  0
    1997 "1997" 5411  845.833  418.281               4300
    2000 "2000" 7990      450      450                  0
    2006 "2006" 3357    633.1  392.522           4273.425
    2003 "2003" 3821  776.475        0                  0
    1997 "1997" 5912      450        0               1350
    2003 "2003" 7990      625  500.337               1875
    1998 "1998" 3312  594.166        0           1782.498
    1999 "1999" 3714  708.173  665.683           5152.095
    1998 "1998" 3576  525.732      525           1576.098
    1998 "1998" 2300 1044.336        0                  0
    2000 "2000" 7372     1200     2800              30600
    1996 "1996" 7373      400        0                  0
    1997 "1997" 3841  233.333   45.678                300
    2000 "2000" 5122      675    245.9           2753.491
    1997 "1997" 2890  574.997      245           2459.991
    2002 "2002" 2836      810      800                  0
    2006 "2006" 2835  574.304   36.143             1156.2
    1997 "1997" 7372  375.394        0                400
    1999 "1999" 3674      350  639.396               3850
    2006 "2006" 3663   415.35        0 1246.0500000000002
    2003 "2003" 3357      600   60.885           2116.327
    2003 "2003" 7990  998.462     1225           8995.386
    2005 "2005" 7372  445.747        0              333.7
    1999 "1999" 3661  340.018  103.972             841.52
    1998 "1998" 2836  496.923      354                  0
    2006 "2006" 7389      520   589.16                  0
    2001 "2001" 2860  512.629    202.2           2397.815
    2002 "2002" 2451      330     1670                  0
    1998 "1998" 3842   309.04  138.376  894.8320000000001
    2000 "2000" 3571 1234.641  3806.33                  0
    2004 "2004" 7372  380.015        0              619.4
    2000 "2000" 2911     1200     3000                  0
    1999 "1999" 3320      735     1029              12900
    2004 "2004" 3569  494.766    800.8           4159.925
    1998 "1998" 1000 1133.524      975           8029.445
    2006 "2006" 3826      575        0               4125
    1998 "1998" 3823      250    157.5             1222.5
    1998 "1998" 3570      750        0              32250
    2000 "2000" 2020      735   124.95             1719.9
    2005 "2005"  100      348      420               1880
    1999 "1999" 2834    692.5   539.63               2543
    1997 "1997" 3570  901.939      100               6450
    1997 "1997" 1382  841.667     1037                  0
    2006 "2006" 3812      650        0             4133.4
    2000 "2000" 2050      675    113.4           2805.444
    1997 "1997" 3714   283.33      300 1749.9899999999998
    2001 "2001" 3674  295.385   76.475                  0
    2004 "2004" 5945  531.135      390                800
    2003 "2003" 1311      325      400               2175
    1996 "1996" 2211  531.599        0           1594.797
    2005 "2005" 7372      546  301.938                  0
    2005 "2005" 5040     1100     1100               6600
    1999 "1999" 2621      990  698.465           5065.395
    1997 "1997" 3944      500        0             4312.5
    2004 "2004" 3420   1462.5     3000            13387.5
    1996 "1996" 3561      540    425.2 2895.6000000000004
    1996 "1996" 6794  1501.93     2250                  0
    2001 "2001" 7372  422.917  167.301               2100
    2000 "2000" 1311      375  461.825 2510.4750000000004
    2002 "2002" 7363      350        0               1050
    1998 "1998" 3730  553.334   282.15 2506.4519999999998
    1997 "1997" 3350      470      322               2376
    1998 "1998" 5411      437  233.402 2011.2060000000001
    1999 "1999" 7372  256.833    86.94           1031.319
    2004 "2004" 3560      375       75                  0
    1997 "1997" 7372      290      145                  0
    2006 "2006" 7372      535      660                535
    2000 "2000" 2836  680.016     1445               5400
    2003 "2003" 7370      863      450               5250
    2004 "2004" 3674  334.517  247.031                  0
    2003 "2003" 2040      770        0             2810.5
    2005 "2005" 7372      400  351.764                  0
    2005 "2005" 3531  665.016 1130.527  5386.629000000001
    2005 "2005" 2780      750     1200               5850
    2006 "2006" 3949  746.539      680             4036.5
    2006 "2006" 5013   524.14        0            4192.71
    1998 "1998" 7822     1300 4011.663                  0
    2006 "2006" 3695  434.002        0            868.004
    2003 "2003" 7381      550      300                  0
    2004 "2004" 8071      325      325                  0
    2001 "2001" 5961  458.654  401.322                  0
    1998 "1998" 2821  332.495        0                  0
    1999 "1999" 3730  675.772      350           3077.316
    2006 "2006" 3317  520.833        0           4593.518
    2000 "2000" 1311  356.154      300           1312.308
    1996 "1996" 1311  586.538    229.5                  0
    1996 "1996" 3312  603.056        0 2392.4840000000004
    2005 "2005" 7372      350  360.279                  0
    2004 "2004" 7372      400      400               1600
    2003 "2003" 7990     1250     1850              537.5
    2006 "2006" 7372      450   282.15             1464.3
    2000 "2000" 1381      400   517.48                  0
    1997 "1997" 3241      285  163.445           1345.335
    1997 "1997" 5311  839.846  409.483           3747.987
    1996 "1996" 1311  180.142        0               1600
    end


    Thank you in advance!

  • #2
    At a guess this is do with the number of distinct categories of sub_sectors a variable you use in your tabstat call.

    Comment

    Working...
    X