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
Merge panel data with same variables but different observationsHi I am trying to merge two different datasets with panel data. One of them contains data about sub…
Weighted mean for each year, by regions in a panel dataI have a panel dataset of 51 countries for 19 years. For each of the panels, it is subdivided into f…
Drop observations if they have equal values on variable A but different values dummy variable BHello everyone, I would like to drop all observations, that have the same value on variable product…
Total Factor productivty using malmq2 commandHi every body,,, Currently i am conducting study to evlaute the productivty and the tehcnical effic…
sum of a variable under a conditionI am trying to summarize the serval variables if they are greater than the maximum of another variab…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape wide with different number of observations for each value
Post a Comment