Hey colleagues,
I encountered a setback in converting the attached long format dataset (the source) into the wide format (the target). It is primarily because in the long format the target variable "seriesname" contains two prospective variables: tpop and upop.
My logfiles are as follows:
encode seriesname, gen(seriesname2) /*convert seriesname into a numeric variable*/
reshape wide yr, i(country) j(seriesname2)
However, Stata responds with the folloiwng: "values of variable seriesname2 not unique within country."
I have no idea how to solve this problem and make it to convert the dataset. Is it that "reshape" is not the right instrument for my purpose?
Looking forward to replies!
I greatly appreciate your help!
Sincerely
Raymong Lucas
I encountered a setback in converting the attached long format dataset (the source) into the wide format (the target). It is primarily because in the long format the target variable "seriesname" contains two prospective variables: tpop and upop.
My logfiles are as follows:
encode seriesname, gen(seriesname2) /*convert seriesname into a numeric variable*/
reshape wide yr, i(country) j(seriesname2)
However, Stata responds with the folloiwng: "values of variable seriesname2 not unique within country."
I have no idea how to solve this problem and make it to convert the dataset. Is it that "reshape" is not the right instrument for my purpose?
Looking forward to replies!
I greatly appreciate your help!
Sincerely
Raymong Lucas
Comment