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
Problem With Monthly Lag Variables Not Lagging Across New YearsDear Statalist Masters, My first post here at statalist, after having been a passive reader for sev…
Input pre-defined logistic regression equation in stataHello Everyone, Please am in need of help. I am trying to use a previously published logistic regr…
new to SSC lbsvmatDear all, Thanks to Prof Baum, a new program is available from SSC. "lbsvmat". This program works li…
How to round the wanted output valuesDuplicated post due to internet lagging and double-clicking. My apology …
Standardisation of variables and differing standardised coefficientsHi all, for my bachelor thesis I want to find out individual factors that promote a (regular) parti…
Subscribe to:
Post Comments (Atom)
0 Response to Reshape wide with different number of observations for each value
Post a Comment