I'm trying to reshape a dataset after merging with other datasets. While reshaping from long to wide, it gives the following error:
reshape wide expenditure, i(HH_ID) j(item_code)
(note: j = 409 410 411 412 413 414 415 419 420 421 422 423 424 425 426 427 428 429 439 449 459 479 499)
variable centre_code not constant within HH_ID
Your data are currently long. You are performing a reshape wide. You typed something like
. reshape wide a b, i(HH_ID) j(item_code)
There are variables other than a, b, HH_ID, item_code in your data. They must be constant within HH_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 HH_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);
end of do-file
However while checking the dataset, I found that all the centre codes have value 1, yet I'm seeing this error. I cannot reshape according to centre code or drop the centre code variable, as my assignment requires that variable to remain in the dataset.

reshape wide expenditure, i(HH_ID) j(item_code)
(note: j = 409 410 411 412 413 414 415 419 420 421 422 423 424 425 426 427 428 429 439 449 459 479 499)
variable centre_code not constant within HH_ID
Your data are currently long. You are performing a reshape wide. You typed something like
. reshape wide a b, i(HH_ID) j(item_code)
There are variables other than a, b, HH_ID, item_code in your data. They must be constant within HH_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 HH_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);
end of do-file
However while checking the dataset, I found that all the centre codes have value 1, yet I'm seeing this error. I cannot reshape according to centre code or drop the centre code variable, as my assignment requires that variable to remain in the dataset.
