Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reshaping Error

    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.
    Click image for larger version

Name:	Screenshot 2024-08-18 114949.png
Views:	1
Size:	31.3 KB
ID:	1761849

    Click image for larger version

Name:	Screenshot 2024-08-18 114645.png
Views:	1
Size:	222.4 KB
ID:	1761848

Working...
X