How to merge datasets in Stata conditionally?

Easy Question -- I want to join multiple datasets to my master dataset using foreach loop. Error comes up saying unmatched is not a valid option (syntax error).  If I get rid of the unmatched option, the code runs, but the inner join drops data I need.  How do I run a left outer join loop in STATA?

  • Joinby and Foreach command

  • Answer:

    What is the current command loop that you are running? It would be helpful to see that in order to answer your question.

Krishanu Karmakar at Quora Visit the source

Was this solution helpful to you?

Other answers

There's no specific command to support the conception "left outer join" in stata, datasets are jioned by "merge". So if you're using merge to join datasets, maybe you can make it out by two step: 1, join all datasets using merge 1:n(because I don't know the relation of correspondence of your data, using 1:n migt be a universal choice);2, after that, drop all entries if _merge = 2.

Bo. Wu

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.