I have data where my years are recorded in letters from H to CC (representing 1948 to 2021). The variable labels are the years. I want to rename the years into the actual numbers, with a prefix such as Yr1948, Yr1949 etc. and reshape the years long. At the moment, I'm not able to figure out a straight forward way of doing that.
I tried:
rename H-CC Yr1948-Yr2021, but I know that won't work, just an idea. Any ideas?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str38 CountryName str67 IndicatorName long(H I J K L M N) "Benin" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Benin" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Angola" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Angola" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Benin" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Algeria" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Angola" "Goods, Value of Exports, Free on board (FOB), US Dollars" 42700000 67500000 74500000 109300000 94300000 121500000 102300000 "Benin" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Algeria" "Goods, Value of Exports, Free on board (FOB), US Dollars" 413400000 313000000 322200000 369900000 398300000 382600000 389300000 "Angola" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 48100000 49700000 55700000 74400000 89900000 83800000 95500000 "Benin" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Angola" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 9900000 9900000 9700000 11600000 12300000 12700000 15500000 "Angola" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Benin" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Algeria" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 460400000 440300000 415600000 554500000 611700000 549100000 587500000 "Algeria" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 41900000 27700000 18100000 27900000 29000000 16100000 19700000 "Algeria" "Goods, Value of Exports, Free on board (FOB), US Dollars" 7000000 5800000 5400000 6700000 3800000 4700000 4900000 "Algeria" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 700000 500000 400000 900000 600000 500000 300000 "Angola" "Goods, Value of Exports, Free on board (FOB), US Dollars" 3300000 8300000 10300000 11000000 25600000 41700000 28400000 "Angola" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Angola" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Angola" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Mauritania, Islamic Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Mauritania, Islamic Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Togo" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Togo" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Mauritania, Islamic Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Togo" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Togo" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Congo, Dem. Rep. of the" "Goods, Value of Exports, Free on board (FOB), US Dollars" 242700000 242700000 267400000 395900000 400400000 407000000 396500000 "Ghana" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 8700000 9200000 7500000 9600000 13500000 11100000 7700000 "Ghana" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Ghana" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 117600000 143300000 125000000 169800000 180000000 198700000 193600000 "Central African Rep." "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Central African Rep." "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Sudan" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 2600000 1800000 1700000 3400000 5000000 3800000 2500000 "Sudan" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Tunisia" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 175500000 139400000 144200000 179300000 182400000 170300000 167800000 "Tunisia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Tunisia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Sudan" "Goods, Value of Exports, Free on board (FOB), US Dollars" 100000 . . . . 100000 200000 "Sudan" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Sudan" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 90200000 88200000 75700000 117100000 174000000 140000000 135900000 "Burkina Faso" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Burkina Faso" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Chad" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Chad" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Rwanda" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Zimbabwe" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Zimbabwe" "Goods, Value of Imports, Free on board (FOB), US Dollars" 170800000 200200000 162300000 237100000 244300000 215100000 . "Mauritius" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . 100000 300000 "Madagascar, Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" 41000000 49200000 65100000 64400000 84500000 79300000 86300000 "Togo" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Togo" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Egypt, Arab Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 663200000 669000000 606500000 679000000 621200000 502700000 470200000 "São Tomé and Príncipe, Dem. Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "São Tomé and Príncipe, Dem. Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Sudan" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 900000 4200000 1500000 1800000 100000 100000 100000 "Sudan" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Senegal" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Congo, Dem. Rep. of the" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 189300000 226200000 189900000 305700000 399800000 358600000 362100000 "Somalia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Somalia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Chad" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Chad" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "South Africa" "Goods, Value of Imports, Free on board (FOB), US Dollars" . . . . . . . "Mozambique, Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" 2500000 3800000 2500000 5500000 4200000 3500000 3300000 "Mozambique, Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Madagascar, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 7200000 5800000 5900000 4200000 6000000 4400000 4300000 "Madagascar, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Madagascar, Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" 1500000 1600000 3900000 3900000 4400000 5100000 9800000 "Malawi" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Malawi" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Madagascar, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 75200000 82100000 83800000 128800000 131700000 127400000 134300000 "Côte d'Ivoire" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Côte d'Ivoire" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Morocco" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 50400000 44600000 27100000 37700000 45600000 40100000 46600000 "Morocco" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Congo, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Congo, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Egypt, Arab Rep. of" "Goods, Value of Exports, Free on board (FOB), US Dollars" 18500000 13100000 44300000 56200000 48400000 16400000 18900000 "Liberia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Liberia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Kenya" "Goods, Value of Exports, Free on board (FOB), US Dollars" 5600000 6300000 6400000 7500000 7400000 4100000 4700000 "Kenya" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Equatorial Guinea, Rep. of" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Tunisia" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 100000 100000 500000 300000 . 200000 100000 "Tunisia" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Mali" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Morocco" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 374600000 354200000 313100000 437100000 501800000 480400000 469700000 "Mauritius" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" 40100000 . . 21000000 45800000 50600000 43500000 "Djibouti" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Djibouti" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Morocco" "Goods, Value of Exports, Free on board (FOB), US Dollars" 165200000 174000000 178300000 236300000 253900000 250500000 267200000 "South Africa" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Nigeria" "Goods, Value of Exports, Free on board (FOB), US Dollars" 251500000 297400000 250000000 331200000 356300000 342600000 419000000 "Niger" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . "Somalia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Somalia" "Goods, Value of Exports, Free on board (FOB), US Dollars" . . . . . . . "Rwanda" "Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars" . . . . . . . end
0 Response to Turning variable labels into variable names with a suffix
Post a Comment