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
Related Posts with Reshape wide with different number of observations for each value
multilevel mediation analysis with dichotomous dependent variableI am trying to estimate the mediation effect of a continuous mediator m on a dichotomous variable y.…
Converting Date formatGreetings. I'm having a challenge converting the date formats with slashes "2/9/2016 14:06" (m/d/yyy…
The command "vce(cluster panel_id)"Hello I am reading a paper and have started to study the corresponding Stata codes. However, I don'…
graph hbar - labstyle-Option shifts label into axisI want to print a hbar-graph and manipulate the labelsize by referring to a labelstyle. Why? I do th…
System GMM Hansen Test ProblemI am running the following command for my research and I just cannot pass the Hansen Test for Overid…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape wide with different number of observations for each value
Post a Comment