Dear All,

I am currently working with a country-year panel dataset which has data for value added for multiple sectors. It looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long country int year double(agriculture manufacturing mining utilities construction)
5 1970   981.375378691819 6083.8882699607275  3314.377986731164 506.70685027966016 2006.7123877789525
5 1971 1047.3785337633847 6916.5025883226235  3380.606676519309  574.0725008948751 2235.0557453082833
5 1972 1004.0187968550568  7110.704855608108 3309.9627407452876  656.0828581655715 2027.9986329723647
5 1973  857.5592410758162  6647.521287082387 3364.4174412377624  675.1209768176975 1788.0445962466267
5 1974 1087.0186460911143  6477.841145292657  4110.573046865174  710.5728047619141  2257.390075704935
5 1975 1134.5517052620596    4828.1632395765  3648.174427027457  683.7475882841235 1669.5575805624069
5 1976 1116.2193959399322 5118.6251140941695  4092.781502010798  723.6899811012743 1393.6386137599113
5 1977 1234.8119779118867   5553.11987047624  4204.795616042943  765.4049653156358  1381.483073306251
5 1978 1189.0248529620965  6067.751221019465  4271.604682434886  816.9282885945638 1492.8891916388243
5 1979  1262.397738606136  6547.328358169937  4500.897755405062  872.4694857071697 1849.1763433825088
5 1980 1310.8037648876589  6951.561122736998  4734.184848648669  916.3115795981843  2291.850442816282
5 1981   1361.21761552351  7129.405790177698  5098.548425411251  935.1010484086189 2775.4757319337446
5 1982 1351.3967355295133  5635.297596050137  5431.141386362448  935.6919122076893  2122.026921332625
5 1983 1323.0689527912727  5809.858704261644  5317.674901321783  974.4525774266994 1817.1942903442387
5 1984   1441.57423805217   6326.53118621761  5608.693742154081  1043.938160197364 1857.7914351603458
5 1985  1543.100313012334  6496.477562539438   5791.14785009947 1083.7623802547005  2184.456832982976
5 1986 1660.7047304139123  6991.434529896969  5844.194450763241 1150.0663227014993 2397.3264521622946
5 1987 1818.8784210569606  7360.349185204471  5825.051991719084 1212.8607937144413  2616.440559550564
5 1988 2028.3106346387979  8008.985307139801  6281.010706743252  1281.282952848104 2841.1835013807054
5 1989  2155.034353611419  8886.108881625602  6770.549692753161  1180.786731574298 3157.5709039675676
5 1990   2351.34021390641  8973.802928950769  6833.363549901618 1077.8464141233414 3474.1928413228406
5 1991 2408.4364500945303  9452.749982148323  7679.688653679325 1368.4682503263523  3421.012082585575
5 1992 2697.5166095917593 10531.674004308923  7569.027171831896 1745.8993692111267 3887.8242222622434
5 1993 2781.7553785478876 11295.766898195656  7556.805316858913 1830.5277660732788  4800.750808303282
5 1994  2991.578662240602 11756.838693410447  8228.939157081648 1944.1343699178508  4749.886080404079
5 1995 3198.4717539431185 12642.568025900755  8996.785292525166  2092.459673304508   5221.02245487333
5 1996  3288.185504451532 13048.903995935294 10414.844340025093  2013.910182318858  5670.742873302024
5 1997 3400.8444205103046 13666.359953230405 11589.309516818577 2180.6136392506082  6026.200400763627
5 1998 3480.0746719699564 13352.125643752064 12549.560396035524 2276.8215444742495  6139.222709566625
5 1999  3507.691666495815 13283.739759050579 13878.610178440074 2168.7028528576793  5533.019757328133
5 2000  3739.033132780806 13936.441006213818 14323.552454900651 2374.8681490421977  5493.928485426047
5 2001  4020.677532508271  14022.11307099687 15135.987692954339 2410.9514914702045  5719.199924726687
5 2002  4295.359875214949 14287.256919868087 14496.674452839698  2490.106139597811  5862.724799319365
5 2003  4407.591009192732 14756.880720587662 15295.681421215628  2597.848939476505     6116.296122638
5 2004  4893.195674290561  15787.57945427821 16229.215748930521 2669.7927909571977 6314.7171296878905
5 2005   5235.52366773901 16727.216355640525 15597.436348861484 2750.7696314974487  6953.399167622369
5 2006  5445.435190788036 17387.421512458182 15702.659249244005  2958.520403792658  7228.817939932632
5 2007  5496.648019910568  17914.92334467639  16222.68096332891 2105.2513241878996  7561.054759264848
5 2008  5718.895309529531  18164.10214994937 15307.885730809367 2067.1852711011134  8328.307975440213
5 2009  6168.858138719481 19665.531230700435   14887.4184368782 2185.9714380755613  9188.567039247773
5 2010  6643.054616967439 20749.751555815412 20625.515807991615  1717.334059385173  9910.352150850182
5 2011  6372.830277868871 21521.695290676136 22306.019697880554 1652.4533003991382 10074.898295916159
5 2012                  .                  .                  .                  .                  .
6 1970  68821.93786184487 17369.873736774083  3526.515925579863 2041.1034930415956  6478.822823366367
6 1971  70154.88059311402 19806.013382866688  4021.112799977039  2327.370003468182  7370.674429313272
6 1972  69529.11852637665  21228.31016384425  4309.874383683857 2494.5016114342784  7219.073877877839
6 1973  76405.62475426005 23149.738455664396 4699.9720650859945  2720.285290549922 7473.1613642627735
6 1974  79672.18431101153 23478.436567610952  4766.705948363077  2758.910030983694  7967.122989619162
6 1975  81298.14725613421 27884.128940155526   5661.17096005116  3276.615238697974  9242.602076124318
6 1976  79860.65545789216  27204.02823429808  5523.093619562108  3196.697793851682  9657.891406608484
6 1977  78141.54154392579 31377.195195268836  6370.350195573367  3687.079347003094  9824.914960944541
6 1978  81482.31652129904  36914.34728855157  7494.529641851021  4337.740408238934  9766.317058592982
6 1979  86480.53106427223  40110.23922306626  8143.375106952908 4713.2840817148735   9959.39087194243
6 1980  85198.03664727035  45186.85969769561   9174.05519266953 5309.8288776436475 12622.200547720255
6 1981  91147.25782712108  45972.85443251355  9333.631651989963  5402.189744686262     13022.49539885
6 1982 101655.69523825926 48626.426400488635  9872.372689866636  5714.006347095089  13467.98482994601
6 1983 110119.28092506662 53353.591315590245 10832.104614725418   6269.48723121748  15766.45203965875
6 1984  124303.5092001832  61278.47839969475 12441.053587759634  7200.726856470508  17477.38970981009
6 1985  126595.4729153697   72436.9164726229  14706.49374956509  8511.935404827627 21357.667218341994
6 1986 130796.37675991641  79421.29703643244 16124.496531959472  9332.657753277526  24747.26071581163
6 1987 136949.46533222307   89939.2949550645  18259.91143061495 10568.609298859183 29169.873183938675
6 1988 140433.74440328806 102753.77047817009 20240.274289695364 12444.517907813512  31500.62223648442
6 1989 144752.02644349143 102726.90669706423 18585.498872444587  12045.92373388096 28840.598387041602
6 1990 155359.30865097183 103857.54312662853 16009.664171667959 10333.248612250309 29182.785921071838
6 1991   159087.684325992   117380.464430292  17545.75458490957 11342.875186746853 31974.064723389914
6 1992  166566.1122787945 145099.27530431503 18292.937257386733  12552.35200495757 38697.583006345696
6 1993 174397.55919085976 179038.58372590304 21755.108379221816 12998.873510122829  45662.19714692269
6 1994 181374.32862260463  229234.3566415063 25124.183578975397 13543.017164438932 51906.919430940674
6 1995  190444.4385496261 293532.53271976346   34191.0874256793  18450.14721820064 58341.801828012125
6 1996 200158.65324442572  333720.0491866298 36820.182114367555 18924.544391895302  63306.33906522496
6 1997  207163.2925940071 368590.35520958534   41277.9203685271 23685.839451496056  64963.44862183223
6 1998  214412.5678890425  400340.8864532194  42821.50801665309  28977.71925394508  70821.05924713468
6 1999 220416.11978993574  430023.4113546913  47481.79707818456  34844.40065579689  73853.43390707385
6 2000  225706.0779279122  466665.6071827977 58842.837490595186  36979.48239400304  78040.35211055088
6 2001 232026.00857688286 509624.91748463066  58860.59277227855 42771.547508042335  83334.05398435422
6 2002  238754.8214577816  560306.9317601209  61623.92582143337  50271.42957991981  90657.22914538029
6 2003 244723.57627283974  631506.6268613825  70621.67376257626  55785.21351099297 101611.77245709402
6 2004 260141.22718433995  670682.3291969394  98865.51429976773   75601.4894113703  109872.8095578558
6 2005   273748.487774046  748324.4711984446  110310.7693275924  84353.56371073547 126585.04526160768
6 2006  287435.9121627484  870334.4883952552 121780.59467706362  72293.79046379843   147239.290461974
6 2007    298071.04091277 1004849.0825141772 133722.59182882542   84434.0867865947 170104.38001878318
6 2008 311708.75538201455 1110095.2136394589 147728.46164443574  93277.56500040894 186523.36037079184
6 2009  324749.2434879906 1207014.3575204427 160626.19857142656 101421.35449888217 221133.34201765328
6 2010 338620.23225162644 1352625.1903939417 180003.69346994383  113656.5427613304 250916.70350204606
6 2011                  .                  .                  .                  .                  .
6 2012                  .                  .                  .                  .                  .
7 1970   4166.08956278226  6096.705315576166 1867.8060020608802  1195.187578990279  2933.284089633269
7 1971  4267.720071074892  6612.174997849354 1781.8200480018113 1306.7384196960384  3144.597708073326
7 1972  4515.515804777153  7215.752117827384   1659.21044684351 1471.4087083569211  3201.087487260272
7 1973  4622.287777814628   7831.29011507595 1734.8287385859464 1699.4152342569348 3832.5777400196935
7 1974  4878.711177596934  8483.707446580545 1275.7722402303477 1760.7445384035761  4122.937013126807
7 1975  5160.787583888245  8588.685749537071  1324.656792467882 1882.9085555343866  3714.567827509241
7 1976  5318.332243405078  8965.147072487252 1297.3501871164472 1904.1759755207215  4048.837765736522
7 1977  5492.143362350697  9094.316027864194 1135.4201078296132 1969.4620089671464  4357.310188205705
7 1978  5937.844350699436 10001.145994446908  1061.520413626778   2170.26602093115  4245.886875463278
7 1979 6225.5206856465575 10613.215143423866 1073.9325069683393  2396.294182181272  4221.736009647186
7 1980  6363.332263233388 10741.745100434986 1271.9531345867902 2576.8199564838856  4838.955296242551
7 1981  6567.116333651066  10457.29954216322 1340.5060808886453 2661.3950452667546  5182.556250807869
7 1982  6442.744584838183 10306.678498790812 1363.9935805965235  2746.959316374569  5392.229676756674
7 1983  6623.702279401696 10424.528054544617 1557.4312814427053 2789.4941563472394 6090.6836938243505
end
label values country country
label def country 5 "chile", modify
label def country 6 "china", modify
label def country 7 "colombia", modify
As you can see, each country has data for value added for several sectors, but this is depicted columnwise. Value added for each sector are variables together with "country" and "year" . Currently my panel dataset has two identifiers: country and year. What I would like to do is modify my data in a way that this panel dataset consists of three identifiers:
1) country
2) sector
3) year

I assume this implies also that the value added data for the different sectors would not be depicted in columns anymore, but would be depicted row-wise, in the sense that each country has e.g. 5 datapoints for each year, namely for agriculture, mining, manufacturing, utilities, construction.

If anybody has an idea if and how this can be achieved, I would be very grateful.

Best,

Satya