Dear Statalist
I am working with monthly panel data. to recognize monthly panel data i have used following commands
gen years =monthly(year, "YM")
format years %tm
Actually, my data contains lot of missing observations in almost all variables and i want to impute those missing values by using multiple imputation method. for this i need to convert data in wide form. i used the following command
reshape wide ltir cpi m3 cbpr stir indpro, i(id) j(years)
but wide command is not working and the following error is noted.
*******
variable years not constant within id
Your data are currently long. You are performing a reshape wide. You typed something like
. reshape wide a b, i(id) j(year)
There are variables other than a, b, id, year in your data. They must be constant within id because that is the only way they can fit
into wide data without loss of information.
The variable or variables listed above are not constant within id. Perhaps the values are in error. Type reshape error for a list of
the problem observations.
Either that, or the values vary because they should vary, in which case you must either add the variables to the list of xij variables
to be reshaped, or drop them.
r(9);
*********
Kindly guide me how can i resolve this issue
Regards
Uzma
I am working with monthly panel data. to recognize monthly panel data i have used following commands
gen years =monthly(year, "YM")
format years %tm
Actually, my data contains lot of missing observations in almost all variables and i want to impute those missing values by using multiple imputation method. for this i need to convert data in wide form. i used the following command
reshape wide ltir cpi m3 cbpr stir indpro, i(id) j(years)
but wide command is not working and the following error is noted.
*******
variable years not constant within id
Your data are currently long. You are performing a reshape wide. You typed something like
. reshape wide a b, i(id) j(year)
There are variables other than a, b, id, year in your data. They must be constant within id because that is the only way they can fit
into wide data without loss of information.
The variable or variables listed above are not constant within id. Perhaps the values are in error. Type reshape error for a list of
the problem observations.
Either that, or the values vary because they should vary, in which case you must either add the variables to the list of xij variables
to be reshaped, or drop them.
r(9);
*********
Kindly guide me how can i resolve this issue
Regards
Uzma
Comment