Announcement

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

  • Reshaping data with missing values

    Hi, I have a data set that has a unique respondentid, year they bought the item (year),where they bought their item (frame), how much they bought the item for themselves (Frame2), and how much they bought the item for someone else (frame2). However, I would like to make frame1 and frame2 row wise and rename it frame_price. So if someone made two purchases (Frame1 and frame2), they would have two rows.



    Click image for larger version

Name:	frame.PNG
Views:	1
Size:	16.3 KB
ID:	1641116


    So, for example, I would like the first row and so on to be like this:
    HTML Code:
    respondentid | frame | frame_price | year
    1331653858  | Pearle| 200              | 2018
    1331653858  | Pearle| 200              | 2018
    How can I do this? I tried to do a reshape but it gave me an error and said it can't reshape because I have missing values.

  • #2
    try,
    Code:
    rename frame# frame_price#
    reshape long frame_price, i(respondentid)

    Comment

    Working...
    X