Announcement

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

  • Merge

    I try to merge a file in cross-sectional format containing a certain variable with a master file which has many variables. However, i get the following error. Both the files have same cross-sectional format. Can someone suggest how it can be resolved:

    Error:
    variable stock does not uniquely identify observations in the master data
    r(459);

    stock is the name of firm.

  • #2
    Code:
    duplicates report stock 
    duplicates list stock

    Comment


    • #3
      Telling us you tried to merge a file isn't as useful as showing us the command you used that generated the error message.

      "Cross-sectional" data would typically has multiple observations of each stock at different points in time.

      If both your master dataset and your using dataset are cross-sectional, with variables stock and year identifying each observations (so that for every combination of stock and year there is at most 1 observation), then
      Code:
      merge 1:1 stock year using ...
      would be what you want.

      We know your master file is in cross-sectional format because the error message tells us there are multiple observations for each stock. If your using dataset just has one observation for each stock, and no year variable, then
      Code:
      merge m:1 stock using ...
      would be what you want.


      ​​​​​​​

      Comment


      • #4
        You've since started a new thread https://www.statalist.org/forums/for...l-summary-stat where it is apparent that your observations are identified by stock and mdate.

        Also, I would call that panel data.

        Comment

        Working...
        X