Announcement

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

  • Problem with Merging CRSP and CRSP/Compustat Merged

    I would like to merge CRSP dataset with CRSP/Compustat but it wont work.
    The data I gathered and collapsed it into year from CRSP looks like this:
    permno ticker year cusip volatility
    10001 xyz 2009 10234567 0.5
    10001 xyz 2010 10234567 0.4
    10001 xyz 2011 10234567 0.3
    10001 xyz 2012 10234567 0.45
    10001 xyz 2013 10234567 0.5
    10022 abc 2009 10234434 0.1
    10022 abc 2010 10234434 0.4
    10022 abc 2011 10234434 0.4

    I have tried a file similar to example above with CRSP/Compustat Merged by taking as common variable CUSIP. I have also managed to change the CUSIP of Compustat to 8 digits from 9 digits by using this command substr(CUSIP, 1,8) and changed the name of CUSIP into CUSIP2 in both data sets.) and I have used CRSP/compustat as a master file and tried to merge CRSP file in CRSP/Compustat file. However, the Stata says, CUSIP2 is not common variable in both datasets. Can someone tell me what I am doing wrong ?

  • #2
    With the information you supplied you would need somebody who knows how CRSP/Compustat datasets look like in order to answer your question. If you want to maximize your chances of getting help, you might want to provide (in addition to what you already put up here):
    - a sample/toy compustat dataset (or at least its appearance)
    - your code
    - the output you receive

    if Stata tells you that CUSIP2 is not a common variable in both datasets, it is missing in at least one (or still named differently, even if the information is there). Make sure again it is named identically in both.

    Comment


    • #3
      You might try merging on ticker and year. There are a few duplicate or odd tickers you'll need to look at, but most of it should merge.

      Alternatively, you can use gvkey. You'll need to correct the gvkey in CRSP- I think gvkey in Compustat has 6 digits and you'll find that adding 0's to the gvkey in CRSP may make them match:

      g a=length(gvkey)
      replace gvkey="00" + gvkey if a==4
      replace gvkey="0" + gvkey if a==5

      Comment

      Working...
      X