Announcement

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

  • Merge - variable RIC does not uniquely identify observations in the using data

    Dear Stata Users,

    I am trying to merge two datasets with the merge command.

    Dataset1 is a panel dataset, with 1000 firms over 5 years (5k obs). I have a specific identifier.

    Dataset2 contains the a list of firms with same identifier, not in panel format, reporting the belonging industry.

    I would like to associate the industries in Dataset2 to the firms in Dataset1, repeating the information n times according to the panel time horizon.


    I am trying with:
    #merge m:1 RIC using "" #

    I get the following message:
    variable IDENTIFIER does not uniquely identify observations in the using data.

    Actually, I do not care if the identifier does not uniquely identify observations, because I want that the industry will be repeated through the panel. The same identifier may have for example "energy sector" n times depending on the number of year obs in the panel.

    Thank you in advance, any suggestions would be appreciated.
    Best,
    nr


  • #2
    help joinby

    Comment


    • #3
      O.P. does not show example data, so it is hard to be sure, but it sounds like both data sets may also include the year variable. If so, then I would think the correct way to combine these data sets is
      Code:
      use Dataset1, clear
      merge 1:1 RIC year using Dataset2
      In the event neither this solution nor the one in #2 produces the needed results, O.P. should post back with example data from both datasets, using the -dataex- command* for that purpose. Also show or explain why the results obtained with these two procedures are not suitable for purpose and describe what the proper results would look like.

      *If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

      Comment


      • #4
        Thank you George Ford and Clyde Schechter, I solved it with merge 1:1
        Best,
        nr

        Comment

        Working...
        X