Announcement

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

  • Getting formula right

    Dear all,

    I want to calculate the following decomposition below, which synthesizes how much of the growth in value added per worker (SUMVA_Q05/SUMEMP) can be attributable to growth within each particular sector (first component, within) and how much growth can be attributable to labor flows from one sector to another ( second component, across). I want to calculate each of the following components but I am having a hard time. Any hints?

    The "i" represent sectors (10 sectors in total: Agriculture, Mining, Manufacturing,Public Utilities,Construction,Retail Services, Trade Services, Financial Services, Government Services), \thetas represent shares of employment across sectors, the Y as the dependent variable represents overall growth of value added per worker and the small y's, value added per worker per sector i. Any way I can get both terms in the equation on Stata?

    I have been trying to get the sectors separately (but this does not seem the right approach).

    Code:
     gen Static_st_agr=(shareagr- shareagr[_n-1])* product_agr[_n-1]
    
    gen Static_st_man= (shareman- shareman[_n-1])* product_man[_n-1]

    Code:
     * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str8 Country int Year str28 RegionEMP double(AGREMP MINEMP MANEMP PUEMP CONEMP WRTEMP TRAEMP FIREEMP GOVEMP OTHEMP SUMEMP AGRVA_Q05)
    "ARG" 1950 "Latin America" 1799.5648291591053  32.71936053016555  1603.248665978112 39.263232636198666  314.1058610895893   889.966606420503  425.3516868921522 203.8384212523521  824.9212143014211 410.8922277735111 6543.872106033111 16178.507999562924
    "ARG" 1951 "Latin America"  1835.180985069176 34.373870004356036 1640.9270838315977  42.43317650332856 353.41725110353354  879.7295045909411  427.9256897326511 204.0642231415995   817.735875320775 411.4768705244428 6647.264529822402 17228.953048614298
    "ARG" 1952 "Latin America" 1730.6108856610617 35.553566906967724 1690.1174670723078  49.16047511125743  311.3909822680659  932.2140436960966  461.5083852820269 218.9972848631464  881.0104295553389 441.7270215546997 6752.290541970969 15245.514286704692
    "ARG" 1953 "Latin America"  2029.762405601175   33.8380877611042  1578.124486009093 52.208254254019934 291.60674216280006  903.6309852222607   455.302277483501 209.7324126037948  870.0848773437608 434.6854245447888 6858.975952986299  19548.25525263877
    "ARG" 1954 "Latin America" 1889.3161535853596  33.34185494088162 1721.9974505655446  57.66519795336603  330.1971299919428  913.8400432113071  468.6230497883178 213.7771501118547  893.7040105353452 444.8849404949814 6967.346981178902  18884.25201715512
    "ARG" 1955 "Latin America"  1842.577638028609 32.168114612159506 1839.9442963516249  61.05159518913887 349.18705714603107  933.9117453048434 487.42079360681913 214.8223939327669  879.9022054689286   436.44441946466 7077.430259105581  19610.22888795058
    "ARG" 1956 "Latin America" 1788.8360883099265  32.53114857883985 1870.1772947737677  69.68994363568937  354.8422500317448  938.7739646882453  498.6593942973011 223.7209904898973  934.0389228322638 461.6364082145619 7172.906405852238  19231.30437490124
    "ARG" 1957 "Latin America" 1723.6213934810182 31.822095693506757 1939.5803369397272  74.23760031679973 429.78377036273196  989.6442150412066  505.5587430248754 222.6677737396882  897.1988907515736 455.5557282210646 7269.670547572193 19562.420654995756
    "ARG" 1958 "Latin America" 1677.5115295718424  32.06435809850383  2042.998998311949  74.61502542415563  454.4219885111161  998.5614282386068  518.5852634167563 224.6831267637198  891.1444195855164 453.1539216889299 7367.740059611097  19845.72870213545
    "ARG" 1959 "Latin America" 1724.7515297199611 37.864259389159635 1931.8564698776147  82.98014989353686   429.108931987093   949.112406731169  567.7907879565819 243.4839245965133 1011.6445583185526 488.5395332417897 7467.132551711971 19588.980784415104
    "ARG" 1960 "Latin America" 1649.7947599166494  45.40719522706374  2050.891651089046  90.81439045412748   469.207684012992  998.9582949954023   575.157806209474 238.9498997444496  967.0151497610254 481.6690397670608 7567.865871177291 19774.901690350525
    "ARG" 1961 "Latin America"  1552.541765101795  53.40306522825768 2087.5120145697656  97.43548867810307 475.30911692779705  1112.906258206521   580.423149638714 240.4411511266817  986.3019352406448 477.6385212792936 7663.912465997572 19646.242603230483
    "ARG" 1962 "Latin America" 1645.4090682400545  58.21412601069482 1990.2595528005556 107.17139431771955 441.31529261402727 1168.3407769046053  561.4226268348549 258.7086123609093 1021.5691439587287 508.7674297612569 7761.178023803407 20431.063034662748
    "ARG" 1963 "Latin America"  1737.750977072674  57.64215131531408 1927.1958107816658 114.13952145613892  433.7358807413796 1149.9050118108923  562.5597614569099 279.9211513839463 1051.7635834660264 545.0641654215528   7859.6780149065 20829.906204734878
    "ARG" 1964 "Latin America" 1735.0692266718588  52.15306396915601  2029.157051149406 113.14686289923456 435.74714165287264  1164.744798773831  574.9046903717773 272.8165678768554  1045.251281643617  536.437420949411 7959.428105958019 22283.753889191354
    "ARG" 1965 "Latin America"  1717.819840633513  48.53971038499555 2094.2723683294635 116.85006867698105  415.6149028962503 1239.5448172139918  582.0368115017088 272.0661441808689 1037.5757931798566 536.1237054427986 8060.444162440428 23608.942486527794
    "ARG" 1966 "Latin America"  1656.537586181254 49.298254639986254 2051.6871735379796 122.15284801863439  453.5964715472503 1282.7984737612453  582.7302743400033 288.5136452901216 1100.4073737022613 571.5607328275893 8159.282833846324   22721.1947853995
    "ARG" 1967 "Latin America"  1689.122963290911  51.60636427597539 1979.7032545300906 123.94453836761265   504.123913533349 1324.4944729357599  571.3706583849208 298.2682851006123 1136.3386537207314 580.3603793566853 8259.333483496648 23699.003847511824
    "ARG" 1968 "Latin America" 1562.2803927890373 53.381607116117515 2005.6410809577756  124.8158783648604  578.2637057565712 1393.7054777010294  578.4972976879042 308.0811590223892 1175.7375961034368 580.2067773958114 8360.610972894932 22772.658420247517
    "ARG" 1969 "Latin America" 1541.6146664823405  47.55316278050974 2049.4972166956827 112.64816576617625  654.4677358793234 1475.2659447897015   597.032401161746 295.3258317380331 1129.6573533155681 560.0678671701727 8463.130345779253  24112.22656261502
    "ARG" 1970 "Latin America" 1533.4763226338705 42.834534151784084  2013.223105133852 102.80288196428181  728.1870805803295 1507.7756021428002  616.8172917856909 286.2625990634161 1158.4866551538269 577.0407577469659 8566.906830356818  25451.79470498252
    "ARG" 1971 "Latin America"  1506.313706486001 43.252694962877946  2009.784508849519 102.85545064841668  750.1872213228692 1537.8220472412897  599.0907401181117 281.9607844093545 1213.2641806654387  604.325374870611  8648.85670957449  24112.22656261502
    "ARG" 1972 "Latin America"  1482.532483654143  43.63012605481207 2012.0141820570557 102.80245921924842  763.1919791357532 1555.2930039426471  581.2766059850491 296.1400176157858 1264.7428278447492 629.9668248122105 8731.590510321454 22772.658420247517
    "ARG" 1973 "Latin America"  1458.812936284326  44.03925250700278 2004.7824964848992 102.81580313237032  778.4639182656072 1573.6752801815496  564.3561451813589 305.7348008658773 1323.3006804415745 659.1344181411301 8815.115731485696 25224.106068886063
    "ARG" 1974 "Latin America" 1438.0413817852905  45.92853565188176 2068.4353947926643 106.24424863966357  835.7082122868625 1643.6386013164315  566.1256871436048  327.914278957958 1404.3395368760757 699.4997714370667 9135.875648887499 25912.231724644247
    "ARG" 1975 "Latin America"  1486.640989793378 47.382442485828534 1984.9228704706516 108.60333752916485  728.9715266161128 1599.6183987974543   561.777897567999 434.7076774778259 1496.5631422799672 745.4362342419427 9194.624517260325 25202.602142143616
    "ARG" 1976 "Latin America" 1390.2223284833858 46.053540072435524 1982.9200293449796 104.59035677664497  868.6911818434974 1674.4097627459962  525.2029613695215 371.8885694829303  1493.562686262992 743.9417108428863 9201.483127225269 26342.310259493115
    "ARG" 1977 "Latin America" 1331.3213139577906  47.12209434881647 2038.0339045082706 106.03667638250893  909.4487297124381 1776.3788245530257  516.8989782550958 264.6551467492043  1642.669095015418 818.2114270356931 9450.776190518262 27008.931988508863
    "ARG" 1978 "Latin America" 1321.3127411526482  47.32266066081904 2079.3634866813672 105.51241752197511  864.0339169453649  1713.157752533366  499.3064611792089  405.468379897628 1669.8337899352912 831.7421276879569 9537.053734195626 27740.065497751933
    "ARG" 1979 "Latin America"  1291.195241887408  48.37004467071265 2029.6833240182743 106.85966420931392  902.2663890716675  1753.100159754715 490.89822590421977 382.7337048586496  1801.098235211529 897.1247841307087 9703.329773717198 28707.742201161884
    "ARG" 1980 "Latin America" 1257.0606380770248  49.37319096108161  2078.711716579112   108.076534435934 1050.0084976443798  1781.542067605897  481.9734472662232 414.1775488343228 1676.1503764681136 834.8884115601609  9731.96242943225 26793.892721084427
    "ARG" 1981 "Latin America" 1243.2790638748925  49.78531839237336 1924.8147751697472 110.61533810036823  989.8811629224501 1927.6818856265884    502.66217216683 494.0907199740545  1676.573204263574  835.099021557612  9754.48266204849 27596.328566610704
    "ARG" 1982 "Latin America"   1227.22499218707 36.694215679180864 1781.2045270458907  82.75333780476582  792.4884065746703 1972.5584128941557 383.19119581055384 496.6910527772876  2093.303395555392 1042.671809978846 9908.781346307813 29178.806699183457
    "ARG" 1983 "Latin America" 1254.0563890140897   42.8757659399512 1895.7092666344713   98.1462363556649  794.1428628187678  2060.517149914054 463.09789025797124 547.3026517971596 2041.9390938948816 1017.087315397517 10214.87462202453 29645.339167512688
    "ARG" 1984 "Latin America" 1260.1446056076197 44.745028167320456  2104.917812894767 103.96338055289291  786.3417495719865 1988.8782992416402 499.86035699395643 516.7112291339442  2101.058914769255 1046.534824424442 10453.15620135782 29667.732725992493
    "ARG" 1985 "Latin America" 1274.8947530241321 55.237138871809975 1939.1580247933905 130.26886541971757  830.4230227250098  2037.178406571518  638.2312760183497 618.7221622381286 2005.6693447074438 999.0213985729232 10528.80439294242 29100.429244504146
    "ARG" 1986 "Latin America"  1320.889864752072 42.945234887179815 2090.7399828331645 102.80122412765041  837.1511065402366 2155.9571631400217  513.2215547485305 626.8619605216691 2102.1885199666503 1047.097479364108 10839.85409088128 29148.948621210388
    "ARG" 1987 "Latin America" 1300.6673480211884  45.74275519749192 2100.2994592008563 111.14232348388953  889.1103904084137 2229.9843941810113  565.3992439044973 568.4673417296225 2172.6809254377868 1082.209658591645  11065.7038401564 28353.977295177378
    "ARG" 1988 "Latin America"   1314.02546310928  45.89979381124802 2097.5279195786206 108.64282681552237  870.7274072693051    2290.6602008776  579.4564934341071  585.664175372865  2263.867651757318 1127.629653218083 11284.10158524395  30563.47506518462
    "ARG" 1989 "Latin America" 1325.2963610596578  45.48826650762268 2068.8762652915284 104.88729368454061  842.1878679925031 2323.9124033750045   586.525207432036 595.9255916539369 2329.7340841003056 1160.437641001284 11383.27098209842 28051.664255700034
    "ARG" 1990 "Latin America" 1338.9438199334045  45.99298036009097  2081.923647772041 103.31139277347677  831.0731685366102 2405.3725554370244   605.697865934709 618.6413248062037   2446.04919286824 1218.374051578199          11695.38 30429.113714305797
    "ARG" 1991 "Latin America" 1344.6884139689357  46.72867853681788 2105.2072629877307  102.2523584081956   824.079901007047 2501.7547304638147  628.5288049062914 645.3355628055026 2580.6184682606786 1285.402839779132 12064.59702112415 31675.688469681507
    "ARG" 1992 "Latin America"  1323.754611269017  50.62931555857065 2140.8637918976674 100.76785167532782  819.0774867045908  2582.362468978156  676.0230952650426 647.9245909695146 2615.5539797261526 1302.804174458846 12259.76136650289 31742.869145120916
    "ARG" 1993 "Latin America" 1312.6712527435195 45.045672109154154  2041.900975272574 104.07877495972653  679.7220700314895 2689.9925381535704   734.634743113802 736.5564588142981 2556.7715358846744 1273.524712511137 12174.89873359395 32519.179172420754
    "ARG" 1994 "Latin America" 1303.4691383248273  54.74313671957663 1977.5463018822375 111.07484220554771  647.6106703457825 2545.8993215136834  820.4149383007144 841.4172761619195  2586.452528096434 1288.308777705467 12176.93693125619  34949.05385261424
    "ARG" 1995 "Latin America" 1255.5618939852523  51.47085409553181 1732.2202927210528  97.57780626748144  765.5643684461492 2338.5483695022035  771.1127368654514 838.7325449494692  2500.660338217085 1245.575794950325         11597.025  36914.89424664273
    "ARG" 1996 "Latin America" 1235.6564873116654  52.64282576499877 1693.1115230135135 101.79602496532524  809.3619353127356  2422.015873563421  780.8670268840485 898.0091651793648 2590.8937294393336  1290.52093455407 11874.87552598848 36490.169402892345
    "ARG" 1997 "Latin America" 1231.5766866344516  54.26533310451316 1802.9865902154204 117.66624236530977  799.5393973135656   2479.44889943826  832.3782086431878 967.8371015583746 2780.9686627443566 1385.197021719244 12451.86414373668  36658.43474456687
    "ARG" 1998 "Latin America" 1220.9281038789163 48.904034353859466  1774.277091568325  132.2179972299678  797.6018626126075  2700.163776512601  873.6424320809617 1038.867510280225 2947.7114019233773 1468.251372096626 13002.56558253747  39858.93612140831
    "ARG" 1999 "Latin America"  1200.583258603785 41.401200705899825 1674.4346463290058  130.9664271233976  752.0681268402268 2682.4682619981613  918.7598300596889 1149.923157917993  3005.154618602119 1496.863766665231 13052.62329484551 40842.970530141545
    "ARG" 2000 "Latin America" 1171.3009553216841 41.402724295686774 1614.1981893122017 124.19441128332574  739.1961724802098  2788.658086841241  939.0854675148644  1151.77063831427 3085.7807917203636 1537.023562916153         13192.611  40126.26497207438
    "ARG" 2001 "Latin America" 1140.1711472947206  47.53320541814256 1558.8798759665858 112.84740163055434  799.2071631965459 2769.7957620975185  898.0895971856238 1124.236215585519 3119.2904165169116 1553.714665224836 13123.76545011696  40548.26764989399
    "ARG" 2002 "Latin America" 1139.7779221545227  51.01598440955894 1456.1682231979585  92.21227513149012  682.8000955575557 2552.1850339741654   826.115607910787 1088.336626841028  3572.537517840053 1584.007524140444 13045.15681115756 39621.919688790425
    "ARG" 2003 "Latin America" 1089.6502017611247  65.86244906329081 1626.6699119328646  98.10842152501512   832.314355759393  2856.473719552791  773.6779877730598  1130.98434628812 3746.1271042408985 1517.217410869335 13737.08590876589  42344.66362341463
    "ARG" 2004 "Latin America" 1108.4400072207948  78.81599157688669 1833.8680433666236  93.29143155598481  981.5448154321779  3180.033687040037  868.5448559192489 1175.163769639188 3732.0546009108066 1622.569816968106 14674.32701962985 41697.675211260575
    "ARG" 2005 "Latin America"  1133.746888749203  75.23876746382768 1879.9724367204637 106.34201909144076 1132.3582660145537  3262.523330347566  892.0762669603372 1330.990438350236 3748.3457915304343 1789.949794771937         15351.544  46330.59362936504
    "ARG" 2006 "Latin America" 1135.9105718768349  90.27989383549031 1965.8034071789314  98.84680666408286 1172.2781182197384  3368.418561906963  898.1957654561415 1452.946080253237 3886.4945177457294 1809.503441729498 15878.67716486665  47542.52779427606
    "ARG" 2007 "Latin America"  1147.505240600247  90.04494520938066 2058.3684560689817 115.29717271309895 1289.0811911155315  3421.550567110324  987.0688024495774 1579.732448550899 3899.5422051903947 1885.740707375204 16473.93173638364  52201.81516654362
    "ARG" 2008 "Latin America" 1163.0227437452581  97.57072150390154  2080.601922405474 131.09251154110603 1308.1009066746858 3591.8118932104794  1033.989553809409 1587.875299290256 4025.4005264154393 1864.481062440189  16883.9471410362  50877.32699029085
    "ARG" 2009 "Latin America" 1153.0841054685825  94.41618117819948 1979.5619769869206 117.14253470102726 1330.0991882584003 3550.6148641617247  1021.948241496036 1680.494594165278  4193.899648545463 1920.846806518215 17042.10814147985 42902.713183833366
    "ARG" 2010 "Latin America" 1168.2905196961183 110.76088949607006  2097.052975198907 126.32973185803877 1330.5365992682712 3693.5241439861966 1049.1504543163494 1734.687818218666  4255.043441352084 1977.161426609295         17542.538  54922.49761445674
    "ARG" 2011 "Latin America" 1161.8609109441732 126.55594516146526  2163.602077878524 152.43915525103859 1414.8029788805645 3767.5997771631005  1059.507139125119 1747.737215126063 4335.8385125264795 1998.713751670915 17928.65746372744 53718.437409488324
    "BOL" 1950 "Latin America" 1051.7075350079783 46.292491224560244 117.17786841216812 1.4466403507675076 26.039526313815145 60.758894732235326 23.146245612280122 4.311219780128136                  . 118.6245087629356 1449.504930196869 2937.7706730349946
    "BOL" 1951 "Latin America" 1019.3087349909941  49.45331374896282 117.08795575486364 1.3896023798474482  37.80148058398251  69.40102119984432 22.884851496796063 4.940986714409109                  . 112.9718249290232 1435.239771798723  2983.294919502406
    "BOL" 1952 "Latin America"  987.1817195721244  50.79233503289883 115.31912204914569  1.378792177538862  48.16523109115227    71.134561242508 27.738388738042698 5.081430726939265                  . 114.3234219057769 1421.115002536127 2929.5763086708607
    "BOL" 1953 "Latin America"  976.3210500629403  54.64968460137516 121.50604447254129 1.4634618825133519 34.265692520773264  64.42957021213623  28.83416012405961 4.617938168186995                  . 121.0416387388583 1407.129240783385  2589.601236052232
    "BOL" 1954 "Latin America"   946.227882930062  46.91732305759177 140.88023102922068 1.4029747334918234  33.51815634291611  66.19631667919036  32.48036478942226 4.760518215832768                  . 120.8973507342064 1393.281118511934 2533.3332674185117
    "BOL" 1955 "Latin America"  948.2465629690853 48.338679770973975  139.4072409944698 1.3279332524638567  41.33723636778274  69.39566524896976 34.340329869864966 5.007376845822098                  . 92.50454384802279 1379.905569167456 2699.4057185316287
    "BOL" 1956 "Latin America"  935.1897060156388  45.66874790948635  132.9934547621734 1.3146480281548436 32.019125394655504  67.72773462070612  35.35301280478363  4.90345292076652                  . 106.8442633906349    1362.014145847  2552.089256963085
    "BOL" 1957 "Latin America"  933.2064146503357  44.58360117908204  93.03642803680854 1.4603006694732164 35.007973708671805  66.03788293027678 30.351001975790254 4.797181271901054                  . 135.8739126940503  1344.35469711639 2554.8207117511297
    "BOL" 1958 "Latin America"  940.0653441021848 26.656579279964237  91.09551002822022 1.0845207766822254  41.68243395961425   58.2101757605555 32.421216834960774 4.242769372858116                  . 131.4656651507231 1326.924215265763 2854.7344474784363
    "BOL" 1959 "Latin America"   943.161204530857 29.384185871765784  89.23672472001341  .9159524983471142  41.39110473286662  58.12944370237583 31.658629914409932 4.148493586537308                  .  111.693992025112 1309.719731582285  2902.938218636609
    "BOL" 1960 "Latin America"  906.8174585460328  26.10819238828835  91.72401587925557  .9077576614353788  43.39872335134418  58.09287750853992 31.957398021192066  4.19322253705438                  .  130.086830944192 1293.286476837335  2902.938218636609
    "BOL" 1961 "Latin America"  932.5950053329035 26.218958060056398  89.47989175934643  .9139953689595048 33.526803347459435  57.10804889568958 31.553006229910253 4.145676744814354                  .   135.59585278418  1311.13723852332 3044.8715448245607
    "BOL" 1962 "Latin America"  914.4531632991274  26.93250605245085  97.34967877635661  .9599104985263974  41.71406469774527  59.53761399735083  32.92663362632166 4.331917889684478                  . 151.0288989266079 1329.234387764172 3015.4136846723445
    "BOL" 1963 "Latin America"  926.7965517212187 29.321093321910645  98.38118116547682 1.0010139209714723  45.65207535636151 61.074015003795296  33.82510767684266 4.456052153527728                  .  147.074235037367 1347.581325357472  3184.126883725948
    "BOL" 1964 "Latin America"  939.9316757617188 30.748461478425956  105.7407094118738 1.0503097564453587  45.32085146371604 62.924176610391676  35.40631003212742 4.882345481277323                  . 140.1766590447971 1366.181499040774 3248.9146240291693
    "BOL" 1965 "Latin America"  959.8601401644374 29.495092851476315 110.92662087394112 1.0923535360022634  63.48926742922523  62.52013110376242 34.551707398976774 4.848054804085139                  . 118.9088509541241 1385.692219116031  3429.939192523463
    "BOL" 1966 "Latin America"  970.3856644031656  33.58485858966976 120.69012244612864 1.2799420300799584 48.213355476651834   67.6629961061655  35.57280589019985 4.965645865571618                  .  123.148638244669 1405.504029052302  3555.703629582657
    "BOL" 1967 "Latin America"   949.914137664561  42.18775137691596 125.82937529654227   1.34147307983417   50.4386237699248  75.74760290145107 37.242674338547324 5.132732542642041                  . 137.7647255897387 1425.599096560158 3450.8999320333287
    "BOL" 1968 "Latin America"  949.4670712057347  41.38206770955801  120.7028296215909 1.3607971834767554 57.386858666993646  76.85036764057658  38.01942767822036 5.643355997203227                  . 155.1686957859102 1445.981471489264 3660.5073271319848
    "BOL" 1969 "Latin America"   903.650311723236  46.35371612628218 135.63049377714574 1.4682806364063288  63.28615245147198  84.55257403147758 43.143577364474474 6.577329673530118                  . 181.9928258076258  1466.65526159165  3317.513407879638
    "BOL" 1970 "Latin America"  915.3841064847896  47.39852978562019 137.75197718945867  1.481204055800631   57.7669581762246  81.46622306903468  42.95491761821829 7.173834201812639                  . 197.0001394214839 1488.377890002443 3462.3330626750735
    "BOL" 1971 "Latin America"  916.7346169347815  52.52810699628466  141.6690901189019 1.7114486026439242 60.353396641220286  84.64570020498331  44.68588724412341 7.784898414380335                  . 211.6842278642759 1521.797373021595  3601.436152149636
    "BOL" 1972 "Latin America"  917.0518750780398  53.53538179704604 149.18258302647425 1.9422804349430645  60.55678528480417  91.97753528223824  47.62788641367814 9.092659742017384                  . 225.0002576111469 1555.967244670388 3698.6177626044678
    "BOL" 1973 "Latin America"   905.140364737836  69.91742000885498 154.53407544733676  2.299620714508772  62.08275100677071  96.35157515114643  50.32785400834118 9.638781466045689                  . 240.6119113549023 1590.904353895743  3869.413805782063
    "BOL" 1974 "Latin America"  890.8928378473208  67.67504494078561 169.12793741855776 2.6863895261366486  65.97904162737635 100.53154411129341  57.21020782504789 10.18671065662798                  . 262.3362140114142 1626.625927964561  4012.234634990914
    "BOL" 1975 "Latin America"  874.6176555674415    67.729553811648 176.09729334940593  2.909942969079292   73.0897303300116 109.84783634396175  64.24575391171464 11.09174358048735                  . 285.5867503368848 1665.216260200635   4325.85150737736
    "BOL" 1976 "Latin America"  858.2575169960143  71.17313514070564   186.547089407307  3.321395062319591  75.49207802899929 116.07335274609174  70.72095121928527 12.13575106982075                  . 305.1079118083339 1698.829181478878  4542.291320714484
    "BOL" 1977 "Latin America"  844.6720850659088  72.33657300579065 195.74580193084586 3.9203072457179524  82.65399217202983 120.15701540517736  79.15513113049313 13.04538428212564                  . 321.4343000547701  1733.12059029286  4512.843727063175
    "BOL" 1978 "Latin America"  838.8720008228478  69.33425505506686 202.70465239466938  4.446168548054904  84.63742791854752 125.31944237895951  89.40344846566651 14.21632220677911                  . 339.1704643392797 1768.104182129871   4608.54840642993
    "BOL" 1979 "Latin America"  838.3149209565756  67.39590388785147 207.74629043878835  5.044047310694148  83.94248821923405 129.95107615979126  93.50377448512825  14.9073358192696                  . 362.9880916476499 1803.793928924983  4744.007337225954
    "BOL" 1980 "Latin America"  845.7494090775582  73.94820341976896 212.43402955692028  5.902207031383689  75.40223955998253 132.22496126029955  96.96827531803066 15.35748723887092                  . 384.0678179360122 1842.054630398827    4810.2644229414
    "BOL" 1981 "Latin America"  868.9610265633847  80.98026938515795 194.44809862683405 7.1212727689311714  67.54816315170295 146.83525753693093 108.09501255322334 15.34258535463246                  . 397.9207287944702 1887.252414735268  4765.707171494573
    "BOL" 1982 "Latin America"  876.1595822761111  84.24398759550745  171.9152240302023   7.96006182004795  62.46437400454295 142.39666144752445 104.69692421646401 15.47789798342657                  . 422.9888406042147 1888.303553978041  5095.302916646699
    "BOL" 1983 "Latin America"   888.871935977316   85.5605015059375 166.88966916399892  7.859346629985338  57.24562206627784 155.91749984505856   108.805253458473  18.0811197483877                  .  441.132059262546 1930.363007657981 4218.6549838746805
    "BOL" 1984 "Latin America"  889.4128528462174 114.89368338720647 167.15019802573653  7.368374447396475  58.63629189756987 161.19596360825355 110.68327611440016 22.29652337595139                  . 482.8121126100344 2014.449276312766  5021.325087689527
    "BOL" 1985 "Latin America"  910.8651204725128  81.21183610719979  158.2217371411401   6.89034488990457 55.397827135773824 180.39950155566694 120.24456021208643 26.30819582229493                  . 554.3193837591174 2093.858507095697  5409.122410090378
    "BOL" 1986 "Latin America"  928.0135127150676  56.44107254922603 155.27145926516712  5.894936137128401  61.41549865590778 214.48174891233347 129.76486093894442 22.37346423323678                  . 559.4476547672709 2133.104208174283    5218.5282340451
    "BOL" 1987 "Latin America"  956.9494192554979  51.04838643105811 162.16060772421343  5.367601278652079   65.6320271181699 221.63879969449286 128.98943544398702 24.74142313304991                  . 579.8640110189449 2196.391711098067  5401.660669417464
    end
    Attached Files

  • #2
    Ideally, I am thinking about getting each component of the decomposition by decade. (1970-1980, 1980-1990, 1990-,2000-2010...) But I am not getting the syntax correctly

    Comment


    • #3
      The problem is not solvable with the information you have presented. Let me tell you how I would approach it and indicate what further information is needed.

      1. This will be best done putting the data into fully long layout. (It is already long on Country and Year), but currently it is wide on sector, and that should be fixed. When doing that, the SUMEMP variable should be dropped because, as a sum of the other sectors, having it as a separate observation in the long data set will lead to serious miscalculations. Also, to get the -reshape- to work easily, the variable RegionEMP should be renamed to eliminate the EMP ending.

      2. Once that is done, it is simple enough to calculate the theta values.

      This code accomplishes steps 1 and 2:
      Code:
      rename RegionEMP region
      drop SUMEMP
      reshape long @EMP, i(Country Year) j(sector) string
      
      by Country Year (sector): egen theta = pc(EMP), prop
      But that's where we reach a dead end. The formula you show involves additional information that you have not provided. First, there is some number k, which apparently represents a lag to be applied to the use of the theta values. But you have not said what the value of k is. Second, the key variable in the formula is yi,t which is the sector-year specific value of value added per worker. But there is no variable in the data set that seems to meet that description. I suppose the variable AGRVA_Q05 has something to do with value added (just guessing because the name contains VA). But you don't have it broken down by sector, so that's not helpful.

      If you can say what the value of k is and provide the value added per worker for each sector in each country and year, then actually calculating the formula from here will not be difficult.

      Added:
      Ideally, I am thinking about getting each component of the decomposition by decade.
      I don't know what "component" refers to here. What pieces of the formula are you thinking about? And is there a reason to calculate them separately?

      If you want to aggregate the data up from years to decades, all you need to do is create a decade variable, -gen int decade = 10*(floor(year/10))-, and then -collapse-. But you need to know whether the appropriate way to aggregate these variables from year to decade is by averaging (simple or weighted), or adding, or some other approach. I have no understanding of what these variables actually measure, so I can't advise you about that.
      Last edited by Clyde Schechter; 03 Apr 2022, 20:17.

      Comment


      • #4
        Thank you for your response. Yes, now that I realize that dataset has a lot of problems. I just got a new one where you have sector represented by a number (sector 0 is the total which can be easily dropped). Ideally the "k" is a lag, indicating a year. For instance, k would be how far I want to go in time. For instance, if I want the terms in the equation to be from 1980-1990, k would be the values in 1980 and t would be 1990. Do you think this dataset is better to work with? (In this case, I already have Real value added separated as a single variable labeled labor productivity) But I would still need to reshape the data to get the shares of employment

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input str27 country str3 country_code str99 sector byte sector_number int year double(Nominal_value_added_LCU Nominal_value_added_USD Real_value_added_LCU Employment Real_labor_productivity_LCU PPP_labor_productivity)
        "Ethiopia"                    "ETH" "Total" 0 1988    21903.306640625   10581.3076171875     242351.640625    20380.556640625  11.891316413879395    2.007141590118408
        "Denmark"                     "DNK" "Total" 0 1976             238883      39517.2890625            926921  2485.989013671875   372.8580322265625    39.86628341674805
        "Croatia"                     "HRV" "Total" 0 1999       138319.53125     19449.45703125     219535.609375   1713.68798828125   128.1071014404297   26.050432205200195
        "Bangladesh"                  "BGD" "Total" 0 2016           16754193      213012.359375          15688437     61125.12109375   256.6610412597656    9.614107131958008
        "Denmark"                     "DNK" "Total" 0 2010            1562742           277866.5           1650590  2787.859130859375   592.0636596679688    82.17001342773438
        "Bangladesh"                  "BGD" "Total" 0 1979       241965.65625     15558.56640625         2747734.5    27628.724609375   99.45209503173828    4.097987174987793
        "Argentina"                   "ARG" "Total" 0 2004        834611.8125       285503.21875         6349561.5    14996.857421875   423.3927917480469   56.183719635009766
        "Fiji"                        "FJI" "Total" 0 1997  2746.989501953125 1902.7755126953125   5190.9072265625  279.7308044433594  18.556795120239258   15.186857223510742
        "Nepal"                       "NPL" "Total" 0 1972   12305.2529296875 1215.3336181640625      386890.28125   4996.56298828125   77.43128204345703   2.0430634021759033
        "Rwanda"                      "RWA" "Total" 0 1974       41993.453125  451.6468811035156       1423369.375   2645.96142578125   537.9403076171875   1.4782865047454834
        "Bulgaria"                    "BGR" "Total" 0 2009     63521.12890625      45156.3984375         70852.375  3275.173095703125  21.633169174194336   30.943098068237305
        "Senegal"                     "SEN" "Total" 0 1973          420542.25      1886.77734375        2671405.75  1147.686767578125     2327.6435546875     9.34644889831543
        "Nepal"                       "NPL" "Total" 0 1979      25240.8828125  2103.406982421875      453440.59375    6321.5029296875   71.72987365722656    2.097346544265747
        "Cambodia"                    "KHM" "Total" 0 1977 10.519539833068848  .6958728432655334  10019.0517578125     3327.404296875  3.0110714435577393 .0021246287506073713
        "France"                      "FRA" "Total" 0 1985             677360         494499.625           1173606              22554   52.03538131713867    50.55424880981445
        "Luxembourg"                  "LUX" "Total" 0 1996   15161.1005859375        19753.46875   24895.220703125  221.8000030517578  112.24175262451172    77.17472076416016
        "Belgium"                     "BEL" "Total" 0 2007       306588.90625       419618.34375       344379.1875    4393.7001953125   78.38021850585938      86.648193359375
        "Denmark"                     "DNK" "Total" 0 1979             319750      60777.8984375           1005697  2529.756103515625   397.5470275878906    41.25376510620117
        "Israel"                      "ISR" "Total" 0 2012        890133.8125      230848.515625        939590.125  3644.320068359375   257.8231506347656    64.21544647216797
        "Lao People's Dem Rep"        "LAO" "Total" 0 1991        741848.1875  1056.638427734375          19916808 1886.8792724609375    10555.4228515625    3.146501302719116
        "Sri Lanka"                   "LKA" "Total" 0 1974       24092.859375  3622.577880859375        1429691.75   4490.45751953125   318.3844299316406      8.7328519821167
        "Bangladesh"                  "BGD" "Total" 0 1983        411623.1875      16722.1640625        3094252.75     31125.26171875   99.41291046142578   3.8439533710479736
        "Romania"                     "ROU" "Total" 0 2017        776642.3125         191645.625        710044.625    8631.2001953125   82.26487731933594     52.4095573425293
        "Norway"                      "NOR" "Total" 0 1996             915029      141869.171875           2006247  2162.699951171875   927.6585083007813     71.4325942993164
        "United Arab Emirates"        "ARE" "Total" 0 1977         97081.5625    24871.998046875        251972.625                350   719.9218139648438    482.2450866699219
        "Luxembourg"                  "LUX" "Total" 0 2001     21343.19921875    19098.888671875    32922.32421875                279  118.00115966796875    87.64855194091797
        "Bulgaria"                    "BGR" "Total" 0 2016         81886.6875     46314.91015625      79847.890625  3027.360107421875   26.37541961669922    38.03168487548828
        "Slovenia"                    "SVN" "Total" 0 2001    18555.900390625      18318.2578125   25768.115234375  919.7999877929688  28.014911651611328   45.180458068847656
        "Viet Nam"                    "VNM" "Total" 0 2000        397923.8125 28.086591720581055         1560870.5     38851.58984375  40.175201416015625   .00441801268607378
        "Malawi"                      "MWI" "Total" 0 1986  3504.137451171875    1882.8583984375       1310270.625  3226.510498046875  406.09527587890625    2.851658821105957
        "Italy"                       "ITA" "Total" 0 1975      72785.0859375      215871.578125       827459.3125    20216.923828125   40.92904281616211   41.669673919677734
        "Bangladesh"                  "BGD" "Total" 0 1986         651138.125        21414.15625        3493271.75     33210.90234375  105.18448638916016    4.251195430755615
        "Kenya"                       "KEN" "Total" 0 2014          5017357.5     57065.90234375         5694123.5     18258.94921875   311.8538513183594    7.762590408325195
        "Belgium"                     "BEL" "Total" 0 1980      83382.7890625       115029.46875      197028.40625  3774.727294921875   52.19672775268555   54.996307373046875
        "Bulgaria"                    "BGR" "Total" 0 2013       70523.984375     47859.37890625     73234.8671875  2941.902099609375  24.893712997436523   33.883880615234375
        "Italy"                       "ITA" "Total" 0 2012         1458006.75         1873337.75        1498819.25    24782.599609375  60.478694915771484    82.98145294189453
        "China"                       "CHN" "Total" 0 2009        34851.78125   5101.69189453125    42550.52734375             758280  .05611453205347061  .016433071345090866
        "New Zealand"                 "NZL" "Total" 0 2002             125606     58092.00390625            173069 1860.2000732421875     93.037841796875    59.87627029418945
        "South Africa"                "ZAF" "Total" 0 2002        1114692.875       105750.84375         2503515.5   14332.6826171875   174.6717987060547   30.150114059448242
        "Zambia"                      "ZMB" "Total" 0 1974 2.6587047576904297   4131.88818359375    38431.49609375    1551.3818359375  24.772428512573242    9.899033546447754
        "Bolivia"                     "BOL" "Total" 0 1999     44603.21484375   7673.79248046875       97219.28125   3591.95458984375   27.06584358215332    6.781283855438232
        "Burkina Faso"                "BFA" "Total" 0 1985          847572.25 1886.5838623046875       1777239.875  3413.858154296875       520.595703125    2.617530345916748
        "Bulgaria"                    "BGR" "Total" 0 2010         64657.9375     43764.92578125     71931.3359375  3077.469970703125    23.3735294342041   33.990325927734375
        "France"                      "FRA" "Total" 0 1995            1092558            1435788           1451798              23682   61.30385971069336   61.591732025146484
        "Nepal"                       "NPL" "Total" 0 2016         2442928.25    22749.501953125         2239530.5    10930.916015625  204.88040161132813   7.9358696937561035
        "Egypt"                       "EGY" "Total" 0 2009         994055.125      179284.984375           2079690    22393.115234375    92.8718490600586    31.92586326599121
        "Croatia"                     "HRV" "Total" 0 2005        226627.9375     38093.61328125        278811.375 1718.6400146484375   162.2279052734375    37.37419891357422
        "Cambodia"                    "KHM" "Total" 0 1982 10.026300430297852  .8408775925636292    8231.529296875  3336.675048828125  2.4669857025146484 .0017719162860885262
        "Chile"                       "CHL" "Total" 0 1960  4.522100448608398   4310.99560546875          17225364   2257.81884765625    7629.20556640625   18.512651443481445
        "Philippines"                 "PHL" "Total" 0 1999         3244197.25      82995.1796875           6007564              27742   216.5512237548828   12.245150566101074
        "United Republic of Tanzania" "TZA" "Total" 0 1978     113247.9609375       14684.546875          16412886   7509.87939453125      2185.505859375    9.285484313964844
        "Qatar"                       "QAT" "Total" 0 1993    25794.060546875    7086.2802734375     72686.7890625 240.57667541503906   302.1356506347656       58.58447265625
        "Denmark"                     "DNK" "Total" 0 1985             571842     53965.73046875           1127796     2583.412109375   436.5528869628906    41.76963806152344
        "Cameroon"                    "CMR" "Total" 0 1982            2267159   6899.31787109375         7686117.5  3315.041259765625       2318.55859375    5.629088401794434
        "Russian Federation"          "RUS" "Total" 0 2017           82393952          1412238.5          75795880            71762.5    1056.20458984375    48.64872741699219
        "Greece"                      "GRC" "Total" 0 2001      134711.921875           120546.5     166115.828125   4279.35791015625   38.81793212890625   58.825008392333984
        "Sweden"                      "SWE" "Total" 0 1995            1675350      234864.296875           2409055               4130   583.3062744140625    56.89973831176758
        "Bhutan"                      "BTN" "Total" 0 2004    30302.095703125  668.6773681640625       58456.28125                273  214.12557983398438   14.041559219360352
        "Thailand"                    "THA" "Total" 0 2002            5769577         134300.875         8360166.5     34982.65234375   238.9803466796875   15.525434494018555
        "Philippines"                 "PHL" "Total" 0 2001         3888801.25      76261.9921875         6442038.5              29156  220.95069885253906   12.152002334594727
        "Iran"                        "IRN" "Total" 0 1982   10391.0146484375 124.25443267822266         4355241.5   10312.4638671875  422.32794189453125  .016382824629545212
        "Mozambique"                  "MOZ" "Total" 0 1972          1057.6875     39096.26171875     141545.203125  2771.141845703125   51.07829666137695    19.76144790649414
        "Myanmar"                     "MMR" "Total" 0 2004          8222148.5      9286.19140625          33904400      18950.4765625  1789.1053466796875   3.1716670989990234
        "Bangladesh"                  "BGD" "Total" 0 1996            1826505       43702.390625         5077314.5     42815.37109375  118.58625793457031    5.229527473449707
        "Belgium"                     "BEL" "Total" 0 1995      189742.796875       259640.46875          261428.5  3868.900146484375   67.57178497314453           67.1640625
        "Mongolia"                    "MNG" "Total" 0 1972 4.6887102127075195 .14649981260299683        3884.96875  472.0445556640625    8.23008918762207  .002305249683558941
        "Fiji"                        "FJI" "Total" 0 2005     4327.318359375   2559.07958984375   6204.3388671875  309.9317626953125  20.018402099609375   12.642606735229492
        "Netherlands"                 "NLD" "Total" 0 2008             578387         847236.625            602525               8914   67.59310913085938       87.09814453125
        "China"                       "CHN" "Total" 0 1982  537.3200073242188 283.91448974609375 3374.303955078125         521505.625 .006470311898738146 .0036004341673105955
        "Denmark"                     "DNK" "Total" 0 1988             666052         98945.1875           1190394  2653.700927734375  448.57879638671875   44.179439544677734
        "Bulgaria"                    "BGR" "Total" 0 1995 1177.7320556640625    17533.384765625    57330.44140625  3258.903076171875  17.591943740844727     22.8411808013916
        "Cambodia"                    "KHM" "Total" 0 2018      99366.8984375 24.527969360351563     84980.3984375     9688.376953125   8.771376609802246  .007132793311029673
        "Namibia"                     "NAM" "Total" 0 1972  602.9722900390625  780.2149658203125   28576.826171875 246.90211486816406  115.74152374267578   23.691938400268555
        "Bahrain"                     "BHR" "Total" 0 1977    762.37841796875  1926.901123046875   2702.9716796875 101.60257720947266  26.603376388549805   63.198482513427734
        "Iran"                        "IRN" "Total" 0 2005            2101830 234.47564697265625           9871509    20435.400390625   483.0592346191406   .05318167805671692
        "Romania"                     "ROU" "Total" 0 2011           491686.5       161282.28125       532791.0625    8522.7001953125   62.51435089111328   38.340858459472656
        "Ethiopia"                    "ETH" "Total" 0 2007           160366.5    17886.169921875        538076.625     34228.89453125  15.719953536987305   2.0438759326934814
        "Thailand"                    "THA" "Total" 0 1997            4710309      150180.421875           7568007     33844.02734375      223.6142578125    15.39321517944336
        "Zambia"                      "ZMB" "Total" 0 2012       124088.09375     24107.63671875     153413.421875  3945.765380859375  38.880523681640625   12.425687789916992
        "Indonesia"                   "IDN" "Total" 0 1983     103260.0859375 113.56436920166016        2462613.75      58219.7265625  42.298614501953125   .00849231518805027
        "Malawi"                      "MWI" "Total" 0 1987   4996.95458984375  2262.352783203125         1293947.5  3311.202880859375   390.7786865234375   3.0490942001342773
        "Bangladesh"                  "BGD" "Total" 0 2000         2595319.75       49774.390625           6212807       45428.234375   136.7609100341797    4.847844123840332
        "Saudi Arabia"                "SAU" "Total" 0 2002          718350.25        191560.0625       1238901.375    5913.0068359375  209.52137756347656    85.83812713623047
        "Austria"                     "AUT" "Total" 0 1989      113086.546875      117613.484375      184113.78125  3442.097900390625  53.488826751708984   49.569881439208984
        "Nigeria"                     "NGA" "Total" 0 1966        12770.40625         17878.5625           7816950    24038.779296875   325.1808166503906     5.60585880279541
        "Czech Republic"              "CZE" "Total" 0 2008            3649221      213758.921875         3936608.5    5204.0791015625   756.4467163085938    53.63155746459961
        "Bangladesh"                  "BGD" "Total" 0 2002          3036880.5         52461.3125           6819715     47586.37109375  143.31236267089844      5.1153883934021
        "United Republic of Tanzania" "TZA" "Total" 0 2011           50138900      31892.6171875          68231832    18722.857421875      3644.306640625    5.833528518676758
        "Indonesia"                   "IDN" "Total" 0 1970  4036.962158203125 11.126215934753418      1010532.3125      36686.5546875  27.545032501220703  .004180816002190113
        "Luxembourg"                  "LUX" "Total" 0 1985   6584.27392578125   4473.18798828125   12568.892578125 156.61131286621094   80.25533294677734   54.383296966552734
        "Netherlands"                 "NLD" "Total" 0 1985         200108.875      132769.890625        329002.125   5957.04150390625    55.2291145324707    54.93421936035156
        "Mexico"                      "MEX" "Total" 0 1979  4080.073486328125       178908.34375         7033421.5    18948.916015625  371.17803955078125   45.828243255615234
        "Romania"                     "ROU" "Total" 0 2009           482693.5      158295.203125        566310.375     9017.099609375   62.80405044555664   37.123924255371094
        "Belgium"                     "BEL" "Total" 0 1973     41828.34765625     43291.50390625          162015.5  3759.876220703125   43.09064865112305   46.330665588378906
        "Mexico"                      "MEX" "Total" 0 1993         1491527.75       478726.34375          10247357    30835.587890625   332.3224182128906   34.178977966308594
        "Cyprus"                      "CYP" "Total" 0 2019            19260.5    21561.638671875   19048.689453125  591.6810302734375   32.19418716430664   42.095794677734375
        "France"                      "FRA" "Total" 0 1980             405126        628897.1875           1095101              22715   48.21047592163086    53.18888473510742
        "Bangladesh"                  "BGD" "Total" 0 1980       285815.53125    18494.529296875         2801797.5    28323.033203125   98.92293548583984    4.205173492431641
        "Indonesia"                   "IDN" "Total" 0 1974     12926.71484375 31.148710250854492        1466454.25     42098.36328125    34.8339958190918  .005544422660022974
        "Ethiopia"                    "ETH" "Total" 0 2003         68662.9375    7984.3564453125       341881.4375      29851.5703125  11.452712059020996   1.3591701984405518
        end

        Comment


        • #5
          Yes, this data set is workable. It does not require any reshaping. The code is fairly straightforward. Just one thing is unclear: which variable corresponds to y. You refer, on the one hand, to real value added, but you also refer to labor productivity. In the code below, I assume you want to use PPP_labor_productivity, because unlike Real_value_added_LCU and Real_labor_productivity_LCU, PPP_labor_productivity is in units that apply across all the countries involved, whereas the others are in local currency units and cannot be directly combined.

          Code:
          //  SET THE LAG
          local k = 10 // OR WHATEVER LAG YOU WANT TO USE
          
          //  CALCULATE EMPLOYMENT SHARES BY SECTOR
          drop if sector == 0
          by country year (sector), sort: egen theta = pc(Employment), prop
          
          
          //  CALCULATE THE DELTA-FACTORS AND LAGGED THETAS
          egen panel = group(country sector)
          xtset panel year
          gen delta_y = S`k'.PPP_labor_productivity
          gen delta_theta = S`k'.theta
          gen lagged_theta = L`k'.theta
          
          //  CALCULATE THE WHOLE FORMULA
          by year, sort: egen delta_Y = total(lagged_theta*delta_y + PPP_labor_productivity*delta_theta)
          Note: Code not tested because the example data shown consists entirely of observations with sector == 0, so nothing left to work with. There could be typos here, but I think the substance is correct.

          Comment


          • #6
            Originally posted by Clyde Schechter View Post
            The problem is not solvable with the information you have presented. Let me tell you how I would approach it and indicate what further information is needed.

            1. This will be best done putting the data into fully long layout. (It is already long on Country and Year), but currently it is wide on sector, and that should be fixed. When doing that, the SUMEMP variable should be dropped because, as a sum of the other sectors, having it as a separate observation in the long data set will lead to serious miscalculations. Also, to get the -reshape- to work easily, the variable RegionEMP should be renamed to eliminate the EMP ending.

            2. Once that is done, it is simple enough to calculate the theta values.

            This code accomplishes steps 1 and 2:
            Code:
            rename RegionEMP region
            drop SUMEMP
            reshape long @EMP, i(Country Year) j(sector) string
            
            by Country Year (sector): egen theta = pc(EMP), prop
            But that's where we reach a dead end. The formula you show involves additional information that you have not provided. First, there is some number k, which apparently represents a lag to be applied to the use of the theta values. But you have not said what the value of k is. Second, the key variable in the formula is yi,t which is the sector-year specific value of value added per worker. But there is no variable in the data set that seems to meet that description. I suppose the variable AGRVA_Q05 has something to do with value added (just guessing because the name contains VA). But you don't have it broken down by sector, so that's not helpful.

            If you can say what the value of k is and provide the value added per worker for each sector in each country and year, then actually calculating the formula from here will not be difficult.

            Added:

            I don't know what "component" refers to here. What pieces of the formula are you thinking about? And is there a reason to calculate them separately?

            If you want to aggregate the data up from years to decades, all you need to do is create a decade variable, -gen int decade = 10*(floor(year/10))-, and then -collapse-. But you need to know whether the appropriate way to aggregate these variables from year to decade is by averaging (simple or weighted), or adding, or some other approach. I have no understanding of what these variables actually measure, so I can't advise you about that.

            To answer the question, the information is broader. With dataex, I can only do a subset of variables but I have value added and employment for all sectors in the data. The k would be a lag. For instance, if I want the numbers from 1990-2000, k would be 1990 and t would be 2000

            Code:
             * Example generated by -dataex-. To install: ssc install dataex
            clear
            input double(AGREMP MINEMP MANEMP PUEMP CONEMP WRTEMP AGRVA_Q05 MINVA_Q05 MANVA_Q05 PUVA_Q05 CONVA_Q05 WRTVA_Q05)
            1799.5648291591053  32.71936053016555  1603.248665978112 39.263232636198666  314.1058610895893   889.966606420503 16178.507999562924 1993.1284327560425  40415.97471434924  573.8698758559589  9170.823891190243 24402.991370994157
             1835.180985069176 34.373870004356036 1640.9270838315977  42.43317650332856 353.41725110353354  879.7295045909411 17228.953048614298  2213.876204602217  41425.26497203469  581.8215597759529    9995.7341554297 24741.125296903858
            1730.6108856610617 35.553566906967724 1690.1174670723078  49.16047511125743  311.3909822680659  932.2140436960966 15245.514286704692 2175.4852877594044  38394.62142354514  568.2126205560512   7666.21983954566 24162.424723265452
             2029.762405601175   33.8380877611042  1578.124486009093 52.208254254019934 291.60674216280006  903.6309852222607  19548.25525263877  2291.840254527736 37586.313604102084  592.6550652229521 7280.7911072812085 25149.424772032646
            1889.3161535853596  33.34185494088162 1721.9974505655446  57.66519795336603  330.1971299919428  913.8400432113071  18884.25201715512 2372.9361404571787  40819.54488187431  610.3189371785868  7937.290596303074 25925.754222155414
             1842.577638028609 32.168114612159506 1839.9442963516249  61.05159518913887 349.18705714603107  933.9117453048434  19610.22888795058 2468.1356587221767  44536.58083989712  618.0870825484318  8290.953224260014  27708.98960438185
            1788.8360883099265  32.53114857883985 1870.1772947737677  69.68994363568937  354.8422500317448  938.7739646882453  19231.30437490124 2552.7574527355087 43852.174219054825   640.253510100601  7894.935790559729  27634.34254187005
            1723.6213934810182 31.822095693506757 1939.5803369397272  74.23760031679973 429.78377036273196  989.6442150412066 19562.420654995756 2669.1124195038396 46044.045422873045  646.8389747759215  9364.647549853842 30206.585383949736
            1677.5115295718424  32.06435809850383  2042.998998311949  74.61502542415563  454.4219885111161  998.5614282386068  19845.72870213545 2838.3560075305036  48480.76899535466  608.7896233185144  9574.303838283406 31203.985669654103
            1724.7515297199611 37.864259389159635 1931.8564698776147  82.98014989353686   429.108931987093   949.112406731169 19588.980784415104 3257.9390695132734  42206.05829478758  583.9112012117481   8051.64857181011  27965.88834321222
            1649.7947599166494  45.40719522706374  2050.891651089046  90.81439045412748   469.207684012992  998.9582949954023 19774.901690350525 4174.6751713243675  45347.83868787829  605.8627501294831   8619.20296877095 30510.502368513393
             1552.541765101795  53.40306522825768 2087.5120145697656  97.43548867810307 475.30911692779705  1112.906258206521 19646.242603230483  5422.773933885261  49732.73870164993  708.6430380978776  9108.400975106597  34466.31883251613
            1645.4090682400545  58.21412601069482 1990.2595528005556 107.17139431771955 441.31529261402727 1168.3407769046053 20431.063034662748  6068.342259347792  47484.48087640702  789.7853707045048  8199.890391911822  34101.16654353126
             1737.750977072674  57.64215131531408 1927.1958107816658 114.13952145613892  433.7358807413796 1149.9050118108923 20829.906204734878  6068.342259347792  45300.00341500079   838.470770268481  7687.397242417333 31119.089516821507
            1735.0692266718588  52.15306396915601  2029.157051149406 113.14686289923456 435.74714165287264  1164.744798773831 22283.753889191354   6154.41803607613  52156.39252744371  919.6131028751083  8176.595248752981 32437.695004822417
             1717.819840633513  48.53971038499555 2094.2723683294635 116.85006867698105  415.6149028962503 1239.5448172139918 23608.942486527794  6412.645366261141  58789.55036645825 1049.4408350457118  8246.480678229502  35480.63074636298
             1656.537586181254 49.298254639986254 2051.6871735379796 122.15284801863439  453.5964715472503 1282.7984737612453   22721.1947853995  6799.986361538661  58661.98963878489  1130.583167652339  8875.449543518194  35196.62341048586
             1689.122963290911  51.60636427597539 1979.7032545300906 123.94453836761265   504.123913533349 1324.4944729357599 23699.003847511824  7617.706240457866  59092.50709468248 1211.7255002589661  9970.321271983692  35703.77936740929
            1562.2803927890373 53.381607116117515 2005.6410809577756  124.8158783648604  578.2637057565712 1393.7054777010294 22772.658420247517  8564.539784469578 63477.407108454114 1309.0962993869189 11740.752152055562 37488.968335779755
            1541.6146664823405  47.55316278050974 2049.4972166956827 112.64816576617625  654.4677358793234 1475.2659447897015  24112.22656261502  8564.539784469578  71034.24128803199 1309.0962993869189 14088.902582466675  40897.05636630519
            1533.4763226338705 42.834534151784084  2013.223105133852 102.80288196428181  728.1870805803295 1507.7756021428002  25451.79470498252  8564.539784469578  75568.34179577872 1309.0962993869189 16437.053012877786   42601.1003815679
             1506.313706486001 43.252694962877946  2009.784508849519 102.85545064841668  750.1872213228692 1537.8220472412897  24112.22656261502 12846.809676704364  83125.17597535657 1309.0962993869189 16437.053012877786  46009.18841209333
             1482.532483654143  43.63012605481207 2012.0141820570557 102.80245921924842  763.1919791357532 1555.2930039426471 22772.658420247517 12846.809676704364   87659.2764831033 1745.4617325158922 16437.053012877786 47713.232427356044
             1458.812936284326  44.03925250700278 2004.7824964848992 102.81580313237032  778.4639182656072 1573.6752801815496 25224.106068886063 12520.748517397147  91139.92103918681 1882.2029742337272 14510.593113447874  48023.81490043891
            1438.0413817852905  45.92853565188176 2068.4353947926643 106.24424863966357  835.7082122868625 1643.6386013164315 25912.231724644247  12781.59744484292  96474.38715231481  1994.813408589591 15660.254666333467 51750.804577433366
             1486.640989793378 47.382442485828534 1984.9228704706516 108.60333752916485  728.9715266161128 1599.6183987974543 25202.602142143616 12585.960749258591  94015.23610725581 2115.4674453994458 16374.909145154239  52177.85547792231
            1390.2223284833858 46.053540072435524 1982.9200293449796 104.59035677664497  868.6911818434974 1674.4097627459962 26342.310259493115 12912.021908565808  91177.75413218774  2187.859867485358  18425.65678003124  49460.25883844719
            1331.3213139577906  47.12209434881647 2038.0339045082706 106.03667638250893  909.4487297124381 1776.3788245530257 27008.931988508863 14020.629850210347  98290.37561635839  2292.426699387232 20942.483422834837 52876.666042358775
            1321.3127411526482  47.32266066081904 2079.3634866813672 105.51241752197511  864.0339169453649  1713.157752533366 27740.065497751933  14281.47877765612  87961.94122711057 2372.8627239271345 20818.195687387746 48800.271083146086
             1291.195241887408  48.37004467071265 2029.6833240182743 106.85966420931392  902.2663890716675  1753.100159754715 28707.742201161884  15194.45002371633  96928.38426832571 2622.2144000008334 21377.490496899656  54196.64155296097
            1257.0606380770248  49.37319096108161  2078.711716579112   108.076534435934 1050.0084976443798  1781.542067605897 26793.892721084427  15781.36011046932  93220.74115423675  2823.304461350591 22744.655586817655 57224.820665518964
            1243.2790638748925  49.78531839237336 1924.8147751697472 110.61533810036823  989.8811629224501 1927.6818856265884 27596.328566610704 15576.761664784755  82051.92622837452  2855.068972166581  19962.74062202087  52186.70352571615
              1227.22499218707 36.694215679180864 1781.2045270458907  82.75333780476582  792.4884065746703 1972.5584128941557 29178.806699183457 15126.645084278718  79849.12501718079  2995.206519884181 18040.542818356615  47973.79522777759
            1254.0563890140897   42.8757659399512 1895.7092666344713   98.1462363556649  794.1428628187678  2060.517149914054 29645.339167512688 15488.102338321443  85735.08725792539   3202.61009050623 17770.191509824374  50232.26153182713
            1260.1446056076197 44.745028167320456  2104.917812894767 103.96338055289291  786.3417495719865 1988.8782992416402 29667.732725992493  15317.60363358431   88002.3921649081 3460.4631783066147 15799.330470624316  53244.58403351957
            1274.8947530241321 55.237138871809975 1939.1580247933905 130.26886541971757  830.4230227250098  2037.178406571518 29100.429244504146  14765.18783023599  79287.94286381664  3520.255198666124  13449.97759947912  47381.25805185249
             1320.889864752072 42.945234887179815 2090.7399828331645 102.80122412765041  837.1511065402366 2155.9571631400217 29148.948621210388  13789.93523913957  88292.65879595853 3651.0502432025514 16137.269606289623  50480.44464216224
            1300.6673480211884  45.74275519749192 2100.2994592008563 111.14232348388953  889.1103904084137 2229.9843941810113 28353.977295177378 14826.567363941358  89147.33276516253  3836.031806189784 18475.808425093528  50948.89026291976
              1314.02546310928  45.89979381124802 2097.5279195786206 108.64282681552237  870.7274072693051    2290.6602008776  30563.47506518462 15631.321250300638   85131.9777022984   3574.44171711693  17932.40229494372  48954.11851360128
            1325.2963610596578  45.48826650762268 2068.8762652915284 104.88729368454061  842.1878679925031 2323.9124033750045 28051.664255700034 15508.562182889902  78659.03182987407 3402.5396585833396 13533.786505124117  45597.44194631887
            1338.9438199334045  45.99298036009097  2081.923647772041 103.31139277347677  831.0731685366102 2405.3725554370244 30429.113714305797 15951.858815206457  75749.91514979098 3651.0502432025514 10746.464514156683  45510.57785770157
            1344.6884139689357  46.72867853681788 2105.2072629877307  102.2523584081956   824.079901007047 2501.7547304638147 31675.688469681507 16415.615292091465  83503.25938362662  3772.502784557805 14044.750478250058   52534.1598801853
             1323.754611269017  50.62931555857065 2140.8637918976674 100.76785167532782  819.0774867045908  2582.362468978156 31742.869145120916 18243.361406873566  93169.13819760557  4103.227397171342 16507.650898978798  58245.47370677212
            1312.6712527435195 45.045672109154154  2041.900975272574 104.07877495972653  679.7220700314895 2689.9925381535704 32519.179172420754 20057.467625276695  97497.33618504625  4559.141552412602 18302.783587632894  60246.45003384898
            1303.4691383248273  54.74313671957663 1977.5463018822375 111.07484220554771  647.6106703457825 2545.8993215136834  34949.05385261424  22815.67840822815 101884.36142181292  5053.134953903858  19356.39560105004  64300.90110112878
            1255.5618939852523  51.47085409553181 1732.2202927210528  97.57780626748144  765.5643684461492 2338.5483695022035  36914.89424664273  26555.91622753067  94584.76811425512  5428.662351128049 17002.004182849938 59494.751284480306
            1235.6564873116654  52.64282576499877 1693.1115230135135 101.79602496532524  809.3619353127356  2422.015873563421 36490.169402892345  27758.82700106855 100687.26172185612  5648.690520967372  18437.54110287261  64189.48789527395
            1231.5766866344516  54.26533310451316 1802.9865902154204 117.66624236530977  799.5393973135656   2479.44889943826  36658.43474456687 27949.497427688973 109901.58957180413  6110.348126082584  21494.70827183254   71175.1594128323
            1220.9281038789163 48.904034353859466  1774.277091568325  132.2179972299678  797.6018626126075  2700.163776512601  39858.93612140831 26878.173262914046 111933.40187743191  6576.765010869725 23361.578970594823  73597.41514203532
             1200.583258603785 41.401200705899825 1674.4346463290058  130.9664271233976  752.0681268402268 2682.4682619981613 40842.970530141545 25999.319864637288 103058.35090501276  6813.234098765905  21526.55507250895  68535.42837208968
            1171.3009553216841 41.402724295686774 1614.1981893122017 124.19441128332574  739.1961724802098  2788.658086841241  40126.26497207438 27747.685179973778  99118.20517743148  7261.775924381826  19520.74472734753  66882.74651149304
            1140.1711472947206  47.53320541814256 1558.8798759665858 112.84740163055434  799.2071631965459 2769.7957620975185  40548.26764989399  29041.58651859618  91821.13534435017  7342.799029458833 17256.129383970987  61668.44870772939
            1139.7779221545227  51.01598440955894 1456.1682231979585  92.21227513149012  682.8000955575557 2552.1850339741654 39621.919688790425  27954.87721378356  81761.92732222493  7120.153037772003 11492.559088531025 51327.511504215894
            1089.6502017611247  65.86244906329081 1626.6699119328646  98.10842152501512   832.314355759393  2856.473719552791  42344.66362341463 28995.608127690706  94817.00792603305  7614.076578969185 15442.655132016385  57315.29937429948
            1108.4400072207948  78.81599157688669 1833.8680433666236  93.29143155598481  981.5448154321779  3180.033687040037 41697.675211260575 28873.403452886105 106172.34597537403  8112.461930502652 19983.408144074732 64438.537540816666
             1133.746888749203  75.23876746382768 1879.9724367204637 106.34201909144076 1132.3582660145537  3262.523330347566  46330.59362936504  28819.96958719721 114091.12203451614  8519.980133144356 24059.338762570547  70557.63196578648
            1135.9105718768349  90.27989383549031 1965.8034071789314  98.84680666408286 1172.2781182197384  3368.418561906963  47542.52779427606 29675.404439916707 124249.43895041167  8944.452055929638 28358.194528309275  76148.69953368667
             1147.505240600247  90.04494520938066 2058.3684560689817 115.29717271309895 1289.0811911155315  3421.550567110324  52201.81516654362 29538.532705849357 133692.06538691575  9458.423668766156 31167.288129230354  84272.09086766795
            1163.0227437452581  97.57072150390154  2080.601922405474 131.09251154110603 1308.1009066746858 3591.8118932104794  50877.32699029085 29852.643762656153 139769.61140272173  9777.485286216626  32308.09049664292  90899.02882616318
            1153.0841054685825  94.41618117819948 1979.5619769869206 117.14253470102726 1330.0991882584003 3550.6148641617247 42902.713183833366 29532.616289008856 139003.53673925626  9868.056292723728  31081.35739678874  90823.26065706684
            1168.2905196961183 110.76088949607006  2097.052975198907 126.32973185803877 1330.5365992682712 3693.5241439861966  54922.49761445674  29076.33472122789  152664.4759775696 10475.021129918472 32682.849151080824  101843.0301887884
            1161.8609109441732 126.55594516146526  2163.602077878524 152.43915525103859 1414.8029788805645 3767.5997771631005 53718.437409488324  28052.68604742223 169423.55210595185 10953.166793492712  35647.44074355801 115681.23987735306
            1051.7075350079783 46.292491224560244 117.17786841216812 1.4466403507675076 26.039526313815145 60.758894732235326 2937.7706730349946 3666.3889019445264 1876.5492454289868   122.284180374683 231.73692213340604 1439.6347025178336
            1019.3087349909941  49.45331374896282 117.08795575486364 1.3896023798474482  37.80148058398251  69.40102119984432  2983.294919502406  4096.556653547353 1978.8063316717348  127.1870838331019  361.7021395910136 1726.0462380713814
             987.1817195721244  50.79233503289883 115.31912204914569  1.378792177538862  48.16523109115227    71.134561242508 2929.5763086708607  4258.602134907273 1990.3012734507795 132.23419033441547  479.5189328418253 1797.0537843008328
             976.3210500629403  54.64968460137516 121.50604447254129 1.4634618825133519 34.265692520773264  64.42957021213623  2589.601236052232 4088.0587892445715 1887.8047092543006 129.63853556231135  312.8792272127589 1457.3865890751965
              946.227882930062  46.91732305759177 140.88023102922068 1.4029747334918234  33.51815634291611  66.19631667919036 2533.3332674185117  3536.283669170919  2225.229146059998 129.63853556231135 317.00510713204807 1514.1060314901847
             948.2465629690853 48.338679770973975  139.4072409944698 1.3279332524638567  41.33723636778274  69.39566524896976 2699.4057185316287 3867.1143173722758 2358.1394103801977  134.8298451065196  426.5701405442815 1690.7589513780874
             935.1897060156388  45.66874790948635  132.9934547621734 1.3146480281548436 32.019125394655504  67.72773462070612  2552.089256963085 3496.1385860853693 2172.0650403319178 132.23419033441547  325.0276514195547 1584.6806048767733
             933.2064146503357  44.58360117908204  93.03642803680854 1.4603006694732164 35.007973708671805  66.03788293027678 2554.8207117511297 3417.8996285390785  1535.293161363608 152.27841329677503  365.8280195103027  1552.857100926379
             940.0653441021848 26.656579279964237  91.09551002822022 1.0845207766822254  41.68243395961425   58.2101757605555 2854.7344474784363 2262.7761429680013 1679.4588895091222 129.63853556231135  495.7932369679103  1521.033596975985
              943.161204530857 29.384185871765784  89.23672472001341  .9159524983471142  41.39110473286662  58.12944370237583  2902.938218636609  2523.614891436935 1679.4588895091222 114.68024299742926  512.0487529340712 1542.2573215849523
             906.8174585460328  26.10819238828835  91.72401587925557  .9077576614353788  43.39872335134418  58.09287750853992  2902.938218636609 2327.9858300852347 1808.3564115030504  122.1593892798703   573.006937807175 1605.9284954118539
             932.5950053329035 26.218958060056398  89.47989175934643  .9139953689595048 33.526803347459435  57.10804889568958 3044.8715448245607 2380.1535797790216 1812.1475150911072 129.63853556231135  463.2822050355883 1613.0030702815097
             914.4531632991274  26.93250605245085  97.34967877635661  .9599104985263974  41.71406469774527  59.53761399735083 3015.4136846723445  2464.926173031425 2005.4937980819993 142.10377936637974  597.3902117564164 1701.4352561522064
             926.7965517212187 29.321093321910645  98.38118116547682 1.0010139209714723  45.65207535636151 61.074015003795296  3184.126883725948 2790.9746086175924  2126.809112899814  159.5551206920755  698.9871865449227  1821.703028936354
             939.9316757617188 30.748461478425956  105.7407094118738 1.0503097564453587  45.32085146371604 62.924176610391676 3248.9146240291693  2939.430704820656  2316.348577883631 174.06013166408235  716.3996787364332 1891.6957725195784
             959.8601401644374 29.495092851476315 110.92662087394112 1.0923535360022634  63.48926742922523  62.52013110376242  3429.939192523463 2909.7394855800435  2530.131462807239 193.40014629342483 1064.6495225666438 1946.5549499226458
             970.3856644031656  33.58485858966976 120.69012244612864 1.2799420300799584 48.213355476651834   67.6629961061655  3555.703629582657  3391.397042149982  2843.091974757264 240.13851498100252  850.7246184995145 2164.0999637623977
              949.914137664561  42.18775137691596 125.82937529654227   1.34147307983417   50.4386237699248  75.74760290145107 3450.8999320333287  4216.153132167002  2959.901179921709 257.86686172456643  905.4495939585476 2406.2370226449034
             949.4670712057347  41.38206770955801  120.7028296215909 1.3607971834767554 57.386858666993646  76.85036764057658 3660.5073271319848  4381.104350170405 3034.8353870083347 286.87688366858015 1121.8619969101785 2595.4065998968617
              903.650311723236  46.35371612628218 135.63049377714574 1.4682806364063288  63.28615245147198  84.55257403147758  3317.513407879638   4664.82044513626   3270.65774460448  304.6052304121441  1208.924457867731 2724.0419124281925
             915.3841064847896  47.39852978562019 137.75197718945867  1.481204055800631   57.7669581762246  81.46622306903468 3462.3330626750735   4905.64922342123 3446.9735259847753 327.16858081304366 1166.6369768312054  2708.908346248036
             916.7346169347815  52.52810699628466  141.6690901189019 1.7114486026439242 60.353396641220286  84.64570020498331  3601.436152149636   5110.18873374545  3543.947205743938  349.7319312139432 1211.4119567522325  2733.500391290791
             917.0518750780398  53.53538179704604 149.18258302647425 1.9422804349430645  60.55678528480417  91.97753528223824 3698.6177626044678  4899.051174701093 3733.4866707277556  367.4602779575072  1208.924457867731 2886.7277488648765
              905.140364737836  69.91742000885498 154.53407544733676  2.299620714508772  62.08275100677071  96.35157515114643  3869.413805782063  6097.332610675279  3919.788400803991 408.07430867912643 1248.8522381275827  2977.489494680715
             890.8928378473208  67.67504494078561 169.12793741855776 2.6863895261366486  65.97904162737635 100.53154411129341  4012.234634990914  5643.839360044165  4363.186518385432  448.6883394007456  1342.017058733903  3069.511820299552
             874.6176555674415    67.729553811648 176.09729334940593  2.909942969079292   73.0897303300116 109.84783634396175   4325.85150737736  5412.127480159654  4629.597992394448 458.35834671541687 1506.1645998021822 3320.3672010961063
             858.2575169960143  71.17313514070564   186.547089407307  3.321395062319591  75.49207802899929 116.07335274609174  4542.291320714484  5468.400365274463  5015.242573652255  495.1043745111676 1581.5837402930129  3485.503155288813
             844.6720850659088  72.33657300579065 195.74580193084586 3.9203072457179524  82.65399217202983 120.15701540517736  4512.843727063175   5326.06306763112 5363.6268088948145  551.1904169362608 1754.6041214190373  3572.483161695659
             838.8720008228478  69.33425505506686 202.70465239466938  4.446168548054904  84.63742791854752 125.31944237895951   4608.54840642993   4846.08845929892  5607.682075294683   584.068441806143 1803.4047417366335 3654.4208488905133
             838.3149209565756  67.39590388785147 207.74629043878835  5.044047310694148  83.94248821923405 129.95107615979126  4744.007337225954  4442.247754357342  5764.175528558721   615.012465213091 1783.4408516067076 3692.2382429804466
             845.7494090775582  73.94820341976896 212.43402955692028  5.902207031383689  75.40223955998253 132.22496126029955    4810.2644229414  4538.242676023783  5836.833203288453  659.4944988605787 1577.1473202641407  3614.082295194585
             868.9610265633847  80.98026938515795 194.44809862683405 7.1212727689311714  67.54816315170295 146.83525753693093  4765.707171494573  4709.417697348533  5384.473758969947  742.1358690651921 1415.6301317478178 3929.4049115538437
             876.1595822761111  84.24398759550745  171.9152240302023   7.96006182004795  62.46437400454295 142.39666144752445  5095.302916646699  4566.070309271933  4718.761726771142  760.9551909929754 1290.0444128150393  3669.406833760643
              888.871935977316   85.5605015059375 166.88966916399892  7.859346629985338  57.24562206627784 155.91749984505856 4218.6549838746805  4235.412549499808  4727.529641341565  778.1380501444297 1295.6260003231628  4355.921674390698
             889.4128528462174 114.89368338720647 167.15019802573653  7.368374447396475  58.63629189756987 161.19596360825355  5021.325087689527  3718.613646319895  4775.915540267235  838.6871728686019 1227.2515533486503 3609.1766710852794
             910.8651204725128  81.21183610719979  158.2217371411401   6.89034488990457 55.397827135773824 180.39950155566694  5409.122410090378 3323.1806394071205  4378.436746408045  806.7761487301868 1182.2500040644047  3629.071702195241
             928.0135127150676  56.44107254922603 155.27145926516712  5.894936137128401  61.41549865590778 214.48174891233347    5218.5282340451  2844.966269722541  4462.543778768772  866.5070400661946   928.636621664044  4024.792047012565
             956.9494192554979  51.04838643105811 162.16060772421343  5.367601278652079   65.6320271181699 221.63879969449286  5401.660669417464  2888.227716368823  4574.578242724181  814.9584626118317  919.9153911826011  4353.468862336046
            end

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              Yes, this data set is workable. It does not require any reshaping. The code is fairly straightforward. Just one thing is unclear: which variable corresponds to y. You refer, on the one hand, to real value added, but you also refer to labor productivity. In the code below, I assume you want to use PPP_labor_productivity, because unlike Real_value_added_LCU and Real_labor_productivity_LCU, PPP_labor_productivity is in units that apply across all the countries involved, whereas the others are in local currency units and cannot be directly combined.

              Code:
              // SET THE LAG
              local k = 10 // OR WHATEVER LAG YOU WANT TO USE
              
              // CALCULATE EMPLOYMENT SHARES BY SECTOR
              drop if sector == 0
              by country year (sector), sort: egen theta = pc(Employment), prop
              
              
              // CALCULATE THE DELTA-FACTORS AND LAGGED THETAS
              egen panel = group(country sector)
              xtset panel year
              gen delta_y = S`k'.PPP_labor_productivity
              gen delta_theta = S`k'.theta
              gen lagged_theta = L`k'.theta
              
              // CALCULATE THE WHOLE FORMULA
              by year, sort: egen delta_Y = total(lagged_theta*delta_y +PPP_labor_productivity*delta_theta)
              Note: Code not tested because the example data shown consists entirely of observations with sector == 0, so nothing left to work with. There could be typos here, but I think the substance is correct.
              Exactly, the y's would be Labor Productivity in PPP's. Thank you very much! (real value added per worker would be equivalent to labor productivity)

              If I want to analyze each component of the formula separately, I suppose I can also do

              by, year sort : egen within= total(lagged_theta*delta_y)
              by, year sort egen sc= total(PPP_labor_productivity*delta_theta). Correct? Thank you very much!
              Last edited by Hugo Rocha; 03 Apr 2022, 22:10.

              Comment


              • #8
                For instance, if I want the numbers from 1990-2000, k would be 1990 and t would be 2000
                No, that is definitely not correct. If you want the numbers from 1990-2000, k would be 10. If you tried to set k = 1990, then the formula you showed would require you to use theta10. I'm pretty confident that there are no data on sectoral employment shares in the year 10, and even if somehow there are, most of the countries that exist today did not exist then.

                Comment


                • #9
                  Originally posted by Clyde Schechter View Post
                  No, that is definitely not correct. If you want the numbers from 1990-2000, k would be 10. If you tried to set k = 1990, then the formula you showed would require you to use theta10. I'm pretty confident that there are no data on sectoral employment shares in the year 10, and even if somehow there are, most of the countries that exist today did not exist then.
                  If I want to analyze each component of the formula (by component, I mean each term of the equation) separately, I suppose I can also do

                  bysort country year : egen within= total(lagged_theta*delta_y)
                  bysort country year: egen sc= total(PPP_labor_productivity*delta_theta). Correct? Thank you very much!

                  What can I do if I want to analyze, for instance, from year 1980-1990. The last year of the data is 2019 but the panel is unbalanced
                  Last edited by Hugo Rocha; 04 Apr 2022, 08:26.

                  Comment


                  • #10
                    Sorry, forgot the question mark in the last phrase "What can I do if I want to analyze, for instance, from year 1980-1990?. The last year of the data is 2019 (so the numbers, I got are from 2009-2019) but the panel is unbalanced"

                    Comment


                    • #11
                      If I want to analyze each component of the formula (by component, I mean each term of the equation) separately, I suppose I can also do

                      bysort country year : egen within= total(lagged_theta*delta_y)
                      bysort country year: egen sc= total(PPP_labor_productivity*delta_theta). Correct? Thank you very much!
                      The above code will calculate the terms in the equation separately for each country. If that's what you want to do, it looks correct. Note that the code I gave in #5 pooled all countries together and did not calculate the entire formula separately for each country--I did not see anything in what you said up to this point suggesting that it was to be done separately for each country. If it is supposed to be done separately for each country, be sure to modify the code in #5 to include -country- in the -by-list of the final command.

                      What can I do if I want to analyze, for instance, from year 1980-1990?. The last year of the data is 2019 (so the numbers, I got are from 2009-2019) but the panel is unbalanced
                      Well, if your data run from 2009-2019 it isn't possible to calculate anything for years 1980-1990. I'm sure you know that, so I don't understand what you are asking here. As far as the panel being unbalanced, that's an interesting question and I don't know what to tell you. I assume that by unbalanced you mean that in some country-years certain industries have missing data. Since the formula is a weighted sum over industries, results for those country-years would not be comparable to those for country-years with complete data because the included population of industries would be different. As I do not understand this index from a real world perspective and have been dealing with it just as an algebraic formula, or how it is used, or what it means, I do not know what would be the least bad way to confront this problem. I think you need advice from somebody who does understand it substantively. Perhaps such a person has been following along and will respond. If that doesn't happen, I suggest you consult a colleague in your discipline about this.

                      Comment


                      • #12
                        Originally posted by Clyde Schechter View Post
                        The above code will calculate the terms in the equation separately for each country. If that's what you want to do, it looks correct. Note that the code I gave in #5 pooled all countries together and did not calculate the entire formula separately for each country--I did not see anything in what you said up to this point suggesting that it was to be done separately for each country. If it is supposed to be done separately for each country, be sure to modify the code in #5 to include -country- in the -by-list of the final command.


                        Well, if your data run from 2009-2019 it isn't possible to calculate anything for years 1980-1990. I'm sure you know that, so I don't understand what you are asking here. As far as the panel being unbalanced, that's an interesting question and I don't know what to tell you. I assume that by unbalanced you mean that in some country-years certain industries have missing data. Since the formula is a weighted sum over industries, results for those country-years would not be comparable to those for country-years with complete data because the included population of industries would be different. As I do not understand this index from a real world perspective and have been dealing with it just as an algebraic formula, or how it is used, or what it means, I do not know what would be the least bad way to confront this problem. I think you need advice from somebody who does understand it substantively. Perhaps such a person has been following along and will respond. If that doesn't happen, I suggest you consult a colleague in your discipline about this.
                        Thank you! I fixed the code by doing
                        Code:
                         by country year, sort: egen delta_Y = total(lagged_theta*delta_y +PPP_labor_productivity*delta_theta)
                        I am replicating in the literature the calculation of each component of the equation (within and sc). Many papers have each component or the whole delta (change in value added per worker) by decades. For instance,

                        What was deltaY from 1970-1980, 1980-1990, 1990-2000,... and what was sc and within per decade as well. Do I have to change the local? I mean, the goes from 1950-2019, so it seems possible, right?

                        Comment


                        • #13
                          In your equation, the delta operator refers to the difference between Y (or y or theta as the case may be) at time t and at time t-k. So in an observation for year 1980, the results this code calculates corresponds to the change from 1970 to 1980, in an observation for year 2000 it calculates the changes from 1990 to 2000, etc. If you are looking for changes over a decade, this would be the way to do it. If you want some shorter or longer period of time, then you would change the definition of local macro k to however many years that period of time is.

                          Comment


                          • #14
                            Oh yes, sorry for that. I've just realized. My apologies and thank you very much!

                            Comment

                            Working...
                            X