Announcement

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

  • Appending some country-year observatios within the panel, not at the bottom?

    Dear All,

    the topic merge-append has been extensively debated, I know. Still, I find no quick solution for my problem:

    I have a panel dataset with yearly country-year observations for 16 states between 1957-2002 and a set of covariates. This is my master dataset. My using dataset, however, contains one covariate ranging from 2002-2016, which is also present in the master. I want to add this information to the master, so the covariate spans the full period 1957-2016. The command append seems wrong since I do not want to add this information on the bottom, but at the end of each country year (16) within the panel. The command merge seems also less helpful, since there is no 'overlap' to merge something in.

    For a simple illustration of the panel structure (country year, yearly):

    Master: 1957 |----------------------------------------------------------| 2002
    Using: | 2002 -------------------------------------------| 2016



    Thank you!

    Best,
    Hajo

  • #2
    Welcome to the Stata Forum / Statalist,

    Please take some time to read the FAQ, particularly the advice about the best approch so as to share data/command/output. Thanks.

    That being said, if I understood right, you are particularly puzzled by the fact of the data having the newly appended observations at the end of the rows. If this is the problem, I mean, if the appending was done properly, you just need to - sort - the data according to your will.

    Hopefully that helps.
    Best regards,

    Marcos

    Comment


    • #3
      It sounds like you should use merge and not append, with either:
      - option update, to overwrite missing data in the 2002 variable
      - option replace, to overwrite all data in the 2002 variable
      - option keepus(2003-2016) to keep the original data for the 2002 variable.

      See more info on the options in the help file:
      Code:
      help merge

      Comment

      Working...
      X