Hello,
I am trying to run a 'reshape wide' with this dataset but it does not work:
https://databank.worldbank.org/data/...ent/class.xlsx
Here is my code:
gen _asy = 1
drop GroupCode
collapse (mean) _asy, by(GroupName CountryCode CountryName) // to remove duplicates
reshape wide _asy, i(CountryCode CountryName) j(GroupName) string
What I would like to obtain in the end is a column for each value of "GroupName" with value 1 or 0 (1 for the countries which belong to the group and 0 for the others).
So I was hoping that 'reshape wide' would yield these columns with either 1 or a missing value and that I would only have to replace the missing values by 0.
But here the reshape command is not working and produces only one column for the value of "GroupName" which has a row for the higher number of countries (it actually has a row for all countries). I guess it is because the 'reshape' command requires to have an observation for all countries for each value of "GroupName".
Anyone has a guess on how to solve this issue?
Thank's
0 Response to Reshape wide with different number of observations for each value
Post a Comment