Announcement

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

  • Merging datasets on more than one variable

    Hello everyone,

    I have a dataset containing companies and the funds which have financed them at some point in time. I need to combine this data with a dataset containing details about the fund. Given that I only have the name not any coded identifier, it will be time consuming as it is. However, the problem that each fund that has invested in the company has its separate column, as in the attached print screen.

    The datasets with the fund data that I need to merge with this one has, of course, a column Fund Name and then each variable in separate columns. My question is, can I merge the two datasets on any of the Fund Name n variables? As in, if it finds a match in Fund Name 1, it merges, if not it goes on to Fund Name 2, etc.?

    Thank you for taking the time.
    Last edited by vcheck; 14 Apr 2014, 13:32.

  • #2
    Blame my monitor, my eyesight, or my incompetence at working with photos, but I can't read your photo, so bail out of your question as too difficult to answer from a word description.

    If someone else can read it, they may want to answer.

    Either way, I recommend listing enough of the data to show your structure, and showing that as a code insert.

    I also do recommend using your full real name. My personal willingness to answer questions does vary with people's willingness to follow recommended practice.
    Last edited by Nick Cox; 14 Apr 2014, 13:57.

    Comment


    • #3
      You might want to try reshaping the data set that has the 12 Fund Name variables:

      Code:
      reshape long FundName , i(CompanyID) j(j)
      
      merge m:1 FundName using FundDetails
      If necessary you can reshape back to it's original wide format:

      Code:
      reshape wide FundName <other fund variables>, i(CompanyID) j(j)

      Comment


      • #4
        Sorry, should be "...back to its original wide format..."

        Comment

        Working...
        X