Announcement

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

  • merging segment and annual data from Compustat

    Hello everyone.
    I am writing a research paper where I will look at the difference between US firms with foreign operations versus US firms with purely domestic revenue stream.
    However, to do so I need to merge my segment data file with my annual data file (master file).
    The command I write is: "merge 1:1 gvkey datadate using (segment data location)"
    I seem to get the message "variables gvkey datadate do not uniquely identify observations in the master data" I have tried with 1:m merge and m:1 merge as well. If anyone could help me merge the two data sets, it would be highly appreciated.

    Fred

    Edit: here are screen dumps of how the datasets look like.

    Click image for larger version

Name:	segment.gif
Views:	1
Size:	32.9 KB
ID:	1299582
    Click image for larger version

Name:	total.gif
Views:	1
Size:	21.1 KB
ID:	1299581
    Last edited by fred finn; 23 Jun 2015, 07:11.

  • #2
    Fred:
    what if you
    Code:
    rename revts revt//in both files
    and try

    [CODE]merge 1:1 gvkey revt using (segment data location)/[CODE]
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for your quick reply Carlo. I tried what you suggested, but I still get the message variables gvkey revt do not uniquely identify observations in the master data. I think the reason is because the Segment database creates several revenue posts for the same Date Year, one per Geographic segment. Which means that if a company has operations in 4 different country segments, it will post revenues for all of these in each year. I do not know how to solve this. What would be optimal would be to separate these "double posts" by sumarizing the foreign revenues per year as its own variable.

      Comment

      Working...
      X