Hello,
I want to change the layout of my dataset for only SOME observations (from long to wide). Not sure if transpose is the right word but here is what I have and want to do in detail.
I have data on country JAM for 14 variables over 20 years.

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str20 indicatorcode str24 cntryindID double lastvalue int lastyear double value int year
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2000
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2001
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2002
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2003
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2004
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2005
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2006
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2007
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 33.6800003051758 2008
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 34.9199981689453 2009
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020             35.5 2010
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 35.4599990844727 2011
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 36.1100006103516 2012
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 38.0499992370605 2013
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 37.0299987792969 2014
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020                . 2015
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 32.3400001525879 2016
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020               31 2017
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 28.2900009155273 2018
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 24.6399993896484 2019
"SL.UEM.NEET.FE.ZS"    "JAM-SL.UEM.NEET.FE.ZS"    31.530000686645508 2020 31.4200000762939 2020
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2000
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2001
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2002
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2003
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2004
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2005
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2006
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2007
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 21.1700000762939 2008
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 25.6900005340576 2009
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 27.2999992370605 2010
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 27.0400009155273 2011
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 27.8400001525879 2012
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 28.6399993896484 2013
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 28.3999996185303 2014
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020                . 2015
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 26.5400009155273 2016
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 24.1800003051758 2017
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 23.0699996948242 2018
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 20.6700000762939 2019
"SL.UEM.NEET.MA.ZS"    "JAM-SL.UEM.NEET.MA.ZS"    27.860000610351563 2020 27.7700004577637 2020
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 98.1513290405273 2000
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 94.9265365600586 2001
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 94.4924011230469 2002
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 94.3367233276367 2003
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 102.390777587891 2004
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020                . 2005
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020                . 2006
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020                . 2007
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020                . 2008
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 98.8628234863281 2009
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 99.0639114379883 2010
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 95.7142333984375 2011
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020                . 2012
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 90.8172607421875 2013
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020  88.138557434082 2014
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020   90.54443359375 2015
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 89.5796279907227 2016
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 86.3697814941406 2017
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 83.4190826416016 2018
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020 84.7264099121094 2019
"SE.SEC.CMPT.LO.FE.ZS" "JAM-SE.SEC.CMPT.LO.FE.ZS"  82.93396759033203 2020  82.933967590332 2020
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 97.1339416503906 2000
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 95.2227478027344 2001
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 90.3095779418945 2002
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 91.3424835205078 2003
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020  97.870979309082 2004
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020                . 2005
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020                . 2006
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020                . 2007
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020                . 2008
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 99.1570205688477 2009
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 99.9690704345703 2010
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 94.5564880371094 2011
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020                . 2012
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 90.4056167602539 2013
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 83.2212371826172 2014
"SE.SEC.CMPT.LO.MA.ZS" "JAM-SE.SEC.CMPT.LO.MA.ZS"   82.5367431640625 2020 86.2205581665039 2015
end
But then at the bottom of the same dataset I have data for the average value ("lastvalue") for Latin America (LCN...) and for Uppermiddle income countries (UMC...) for just 1 time period. I want to move the "last value" from both ASP and UMC to the right-hand side of the data for JAM, matching it around the same "indicatorcode".

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str20 indicatorcode str24 cntryindID double lastvalue int lastyear
"SE.TER.GRAD.FE.SI.ZS" "ASP-SE.TER.GRAD.FE.SI.ZS"   31.5758056640625 2017
"SL.UEM.NEET.FE.ZS"    "ASP-SL.UEM.NEET.FE.ZS"     7.716000080108643 2020
"SL.UEM.NEET.MA.ZS"    "ASP-SL.UEM.NEET.MA.ZS"      8.11400032043457 2020
"SE.SEC.CMPT.LO.FE.ZS" "ASP-SE.SEC.CMPT.LO.FE.ZS" 102.13663482666016 2019
"SE.SEC.CMPT.LO.MA.ZS" "ASP-SE.SEC.CMPT.LO.MA.ZS" 102.65520477294922 2019
"SP.ADO.TFRT"          "ASP-SP.ADO.TFRT"               7.61083984375 2020
"SG.VAW.1549.ZS"       "ASP-SG.VAW.1549.ZS"                        .    .
"SL.EMP.VULN.FE.ZS"    "ASP-SL.EMP.VULN.FE.ZS"     6.388000011444092 2019
"SL.EMP.VULN.MA.ZS"    "ASP-SL.EMP.VULN.MA.ZS"    10.006000518798828 2019
"IC.FRM.FEMO.ZS"       "ASP-IC.FRM.FEMO.ZS"       40.650001525878906 2020
"FX.OWN.TOTL.FE.ZS"    "ASP-FX.OWN.TOTL.FE.ZS"     99.73249816894531 2017
"FX.OWN.TOTL.MA.ZS"    "ASP-FX.OWN.TOTL.MA.ZS"     99.48999786376953 2017
"SG.TIM.UWRK.FE"       "ASP-SG.TIM.UWRK.FE"                        .    .
"SG.TIM.UWRK.MA"       "ASP-SG.TIM.UWRK.MA"                        .    .
"SE.TER.GRAD.FE.SI.ZS" "LCN-SE.TER.GRAD.FE.SI.ZS"                  .    .
"SL.UEM.NEET.FE.ZS"    "LCN-SL.UEM.NEET.FE.ZS"     29.49407386779785 2020
"SL.UEM.NEET.MA.ZS"    "LCN-SL.UEM.NEET.MA.ZS"     18.25299072265625 2020
"SE.SEC.CMPT.LO.FE.ZS" "LCN-SE.SEC.CMPT.LO.FE.ZS"  82.33609008789063 2020
"SE.SEC.CMPT.LO.MA.ZS" "LCN-SE.SEC.CMPT.LO.MA.ZS"  77.62348937988281 2020
"SP.ADO.TFRT"          "LCN-SP.ADO.TFRT"           60.26488494873047 2020
"SG.VAW.1549.ZS"       "LCN-SG.VAW.1549.ZS"                        .    .
"SL.EMP.VULN.FE.ZS"    "LCN-SL.EMP.VULN.FE.ZS"     33.77582931518555 2019
"SL.EMP.VULN.MA.ZS"    "LCN-SL.EMP.VULN.MA.ZS"     33.37175750732422 2019
"IC.FRM.FEMO.ZS"       "LCN-IC.FRM.FEMO.ZS"       49.907691955566406 2020
"FX.OWN.TOTL.FE.ZS"    "LCN-FX.OWN.TOTL.FE.ZS"    52.130001068115234 2017
"FX.OWN.TOTL.MA.ZS"    "LCN-FX.OWN.TOTL.MA.ZS"     58.68000030517578 2017
"SG.TIM.UWRK.FE"       "LCN-SG.TIM.UWRK.FE"                        .    .
"SG.TIM.UWRK.MA"       "LCN-SG.TIM.UWRK.MA"                        .    .
"SE.TER.GRAD.FE.SI.ZS" "UMC-SE.TER.GRAD.FE.SI.ZS"                  .    .
"SL.UEM.NEET.FE.ZS"    "UMC-SL.UEM.NEET.FE.ZS"                     .    .
"SL.UEM.NEET.MA.ZS"    "UMC-SL.UEM.NEET.MA.ZS"                     .    .
"SE.SEC.CMPT.LO.FE.ZS" "UMC-SE.SEC.CMPT.LO.FE.ZS"  89.98753356933594 2020
"SE.SEC.CMPT.LO.MA.ZS" "UMC-SE.SEC.CMPT.LO.MA.ZS"  88.79283905029297 2020
"SP.ADO.TFRT"          "UMC-SP.ADO.TFRT"          29.038925170898438 2020
"SG.VAW.1549.ZS"       "UMC-SG.VAW.1549.ZS"                        .    .
"SL.EMP.VULN.FE.ZS"    "UMC-SL.EMP.VULN.FE.ZS"     38.46841812133789 2019
"SL.EMP.VULN.MA.ZS"    "UMC-SL.EMP.VULN.MA.ZS"     35.69723892211914 2019
"IC.FRM.FEMO.ZS"       "UMC-IC.FRM.FEMO.ZS"        35.06666564941406 2020
"FX.OWN.TOTL.FE.ZS"    "UMC-FX.OWN.TOTL.FE.ZS"      68.6500015258789 2017
"FX.OWN.TOTL.MA.ZS"    "UMC-FX.OWN.TOTL.MA.ZS"     76.18000030517578 2017
"SG.TIM.UWRK.FE"       "UMC-SG.TIM.UWRK.FE"                        .    .
"SG.TIM.UWRK.MA"       "UMC-SG.TIM.UWRK.MA"                        .    .
end

What I eventually picture is to have variables "lastvalueASP" and "lastvalueUMC" for each corresponding JAMindicatorcode. This is because I eventually want to compare JAM's "lastvalue" with "lastvalueASP" and "lastvalueUMC" (all of which should be on the same vertical row). Deeply thankful for anyone who can help me achieve this!