Hello Stata people;
I'm working with this data currently:
The first variable is the year, and as you can see, each year is repeated two times, that's because for each year, there are two measures being measured: "Exports" and "Imports". The second variable is an ID for each Exports or Imports, the third variable is the name of the measure, and the fourth variable is the value of that measure ("Exports" or "Imports") in USD$.
My goal here is to reshape or re-organize my data in order to draw the evolution of Exports and Imports by year. Already, I want to delete these ("") from the names of the measures, and also to reshape my data to have both the Exports and the Imports measure on the Y axis.
Is there anyone who could help with this? With many thanks!
I'm working with this data currently:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Year byte Flow_ID str9 Flow double Trade_Value_in_USD 2000 1 `""Imports""' 127534440000 2000 2 `""Exports""' 147399947000 2001 1 `""Imports""' 113766789000 2001 2 `""Exports""' 140564413000 2002 1 `""Imports""' 106556726000 2002 2 `""Exports""' 141897655000 2003 1 `""Imports""' 105360687000 2003 2 `""Exports""' 144293359000 2004 1 `""Imports""' 110826709000 2004 2 `""Exports""' 164521988000 2005 1 `""Imports""' 118547336000 2005 2 `""Exports""' 183562840000 2006 1 `""Imports""' 130311031000 2006 2 `""Exports""' 211799379000 2007 1 `""Imports""' 139472838000 2007 2 `""Exports""' 223133260000 2008 1 `""Imports""' 151334594000 2008 2 `""Exports""' 233522733000 2009 1 `""Imports""' 112433823000 2009 2 `""Exports""' 185101149000 2010 1 `""Imports""' 145007354000 2010 2 `""Exports""' 238684425000 2011 1 `""Imports""' 174356033000 2011 2 `""Exports""' 274426522000 2012 1 `""Imports""' 185109813000 2012 2 `""Exports""' 287842157000 2013 1 `""Imports""' 187261916000 2013 2 `""Exports""' 299439153000 2014 1 `""Imports""' 195281872000 2014 2 `""Exports""' 318367007000 2015 1 `""Imports""' 186812404000 2015 2 `""Exports""' 308869536000 2016 1 `""Imports""' 179517794000 2016 2 `""Exports""' 302580855000 2017 1 `""Imports""' 194554589000 2017 2 `""Exports""' 326868567000 2018 1 `""Imports""' 215828019000 2018 2 `""Exports""' 3.582813e+11 2019 1 `""Imports""' 205725211000 2019 2 `""Exports""' 370766932000 2020 1 `""Imports""' 167762159000 2020 2 `""Exports""' 338701084000 2021 1 `""Imports""' 220984657000 2021 2 `""Exports""' 398989265000 2022 1 `""Imports""' 265026221000 2022 2 `""Exports""' 472702571000 2023 1 `""Imports""' 255439901000 2023 2 `""Exports""' 490187337000 2024 1 `""Imports""' 231680687000 2024 2 `""Exports""' 469603418000 end
My goal here is to reshape or re-organize my data in order to draw the evolution of Exports and Imports by year. Already, I want to delete these ("") from the names of the measures, and also to reshape my data to have both the Exports and the Imports measure on the Y axis.
Is there anyone who could help with this? With many thanks!
Comment