Dear StataListers,
I hope you are doing well. I have the following dataset (part of it I am copying below):
I want to do a reshape to the usual long format so, I am able to do a panel data analysis. I have tried many reshaping command variations, for instance the following reshaping code:
However, I get the error that "variable id does not uniquely identify the observations". I have looked up corresponding help by typing "reshape error" and I do understand that my CountryName variable is non-unique and reshape would work on non-unique CountryName.
Now given that this is the data I have, where CountryName is repeated how do I convert it in long format with CountryName and Year variable so I can do panel analysis on it?
Any help by one of you would be really appreciated! Thank you!
Kind Regards,
Sultan
I hope you are doing well. I have the following dataset (part of it I am copying below):
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str52 CountryName str3 CountryCode str131 IndicatorName str25 IndicatorCode double(YR1960 YR1961 YR1962 YR1963) "Afghanistan" "AFG" "Mobile account (% age 15+)" "WP15163_4.1" . . . . "Afghanistan" "AFG" "Children in employment, total (% of children ages 7-14)" "SL.TLF.0714.ZS" . . . . "Afghanistan" "AFG" "Adjusted net savings, including particulate emission damage (% of GNI)" "NY.ADJ.SVNG.GN.ZS" . . . . "Albania" "ALB" "Educational attainment, at least completed post-secondary, population 25+, total (%) (cumulative)" "SE.SEC.CUAT.PO.ZS" . . . . "Albania" "ALB" "Delay in obtaining an electrical connection (days)" "IC.ELC.DURS" . . . . "Albania" "ALB" "Real effective exchange rate index (2010 = 100)" "PX.REX.REER" . . . . end
I want to do a reshape to the usual long format so, I am able to do a panel data analysis. I have tried many reshaping command variations, for instance the following reshaping code:
Code:
reshape long YR, i(CountryName) j(Year)
Now given that this is the data I have, where CountryName is repeated how do I convert it in long format with CountryName and Year variable so I can do panel analysis on it?
Any help by one of you would be really appreciated! Thank you!
Kind Regards,
Sultan
Comment