Dear Statalist,
I'm trying to reshape a dataset provided by the World Economic Forum, from wide to long. However, I'm having some difficulty.
Currently the variables in my dataset look as follows.
and so on. I would like to reshape it into panel data so it would look like the following,
year country variable1 variable2 variable3
A guide is provided in the Sata journal (http://www.stata-journal.com/sjpdf.h...iclenum=dm0031) however my data is wide by county not year.
So when I try the following I get the following error.
Does anyone have any tips for to overcome this?
I'm trying to reshape a dataset provided by the World Economic Forum, from wide to long. However, I'm having some difficulty.
Currently the variables in my dataset look as follows.
Code:
year variable calbania calgeria cangola cargentina 2015-2016 1.01 Property rights, 1-7 (best)Value 3.0484 3.74812 2.87602 2015-2016 1.01 Property rights, 1-7 (best)Rank 130 106 134 2015-2016 1.02 Intellectual property protection, 1-7 (best)Value 3.2145 3.27317 2.98785 2015-2016 1.02 Intellectual property protection, 1-7 (best)Rank 110 105 125 2015-2016 1. Property rightsValue 3.10376 3.5898 2.9133 2015-2016 1. Property rightsRank 127 106 133 2015-2016 1.03 Diversion of public funds, 1-7 (best)Value 3.21978 3.01587 1.88643 2015-2016 1.03 Diversion of public funds, 1-7 (best)Rank 75 86 136 2015-2016 1.04 Public trust in politicians, 1-7 (best)Value 2.56159 2.90653 1.61751 2015-2016 1.04 Public trust in politicians, 1-7 (best)Rank 92 75 137 2015-2016 1.05 Irregular payments and bribes, 1-7 (best)Value 3.73597 3.09924 2.89357 2015-2016 1.05 Irregular payments and bribes, 1-7 (best)Rank 79 110 120 2015-2016 2. Ethics and corruptionValue 3.17245 3.00721 2.13251
and so on. I would like to reshape it into panel data so it would look like the following,
year country variable1 variable2 variable3
A guide is provided in the Sata journal (http://www.stata-journal.com/sjpdf.h...iclenum=dm0031) however my data is wide by county not year.
So when I try the following I get the following error.
Code:
reshape long c, i(year variable) variable _j contains all missing values r(498);
Comment