Announcement

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

  • Match four files on one variable to create new dataset

    Hi everyone,

    I have four datasets 2010, 2011, 2012, 2013 -

    variables in dataset2010.dta : name, address, bedrooms10, cars10, pool10
    variables in dataset2011.dta : name, address, bedrooms11, cars11, pool11
    variables in dataset2012.dta : name, address, bedrooms12, cars12, pool12
    variables in dataset2013.dta : name, address, bedrooms13, cars13, pool13

    bedrooms, cars and pool are numbers. Only some names repeat across all four datasets.

    My finaldataset.dta should be : name, address, bedrooms10, cars10, pool10, bedrooms11, cars11, pool11, bedrooms12, cars12, pool12,bedrooms13, cars13, pool13.

    What is the command that I should be using?

    Thank you.









  • #2
    From your description, it sounds like you will want to use the -merge- command, on which see help.

    Comment


    • #3
      While Mike's suggestion certainly would work, I suspect you can also do it with append since it looks like you're not joining observations but rather just combining data from different years.

      Comment

      Working...
      X