Announcement

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

  • Merge security daily data and fundamental anual

    Dear Statalist members,
    I am using a dataset from the WRDS database. I have annual data for my firm (gvkey)
    i would like to ask: It's possible to merge these two files as "fundamental" contains 471 variables and 38921 observations, but "daily security" contain 12 variables and 13947724 observations. It does not merge due to the different number of observations.
    When I want to merge annual fundamental data and daily security data with this code:
    Merge 1:m gvkey year month using security daily. doing this, I always receive the following error code:
    Can somebody help?
    Thanky you in advance


    Attached Files

  • #2
    Note that from your previous topic on merging this data

    https://www.statalist.org/forums/for...-security-data

    it seems you need to reduce your daily security data to one observation per year given your objective, which is to calculate the yearly value of Tobin's q, since you only have one observation of book value in each year for each firm from your fundamentals dataset but have daily observations of market value from your daily securities dataset.

    But you have not been able to express which of the many daily observations of market value for each firm/year combination you want to choose to use as market value in calculating Tobin's q for a given firm/year combination.

    Perhaps from your daily securities dataset you choose a single observation per firm/month combination (perhaps from the first day of the month, or the last day) or perhaps you want to create an average of all the values for that firm/month. You then will have reduced your 13 million observations to something like 1 million. Then you can merge 1:1 retaining only those observations that match or appear in the yearly dataset, so the result will be not much larger than your fundamentals dataset.

    But in any event, receive more useful advice, you need to explain how you want to choose a single value of market value for each firm for each year. If gvkey 1690 is in your fundamentals data for month 9 of year 2015, and you have 20 or so observations in your daily security data for gvkey 1690 in month 9 of 2015, which of the 20 observations of market value of gvkey 1690 in month 9 of 2015 do you want to match up to the book value in month 9 of 2015?
    Last edited by William Lisowski; 14 Nov 2021, 08:29.

    Comment

    Working...
    X