I tried to run a python code to get "DGTW return" for my research. This code is based on https://www.fredasongdrechsler.com/data-crunching/dgtw
import wrds
conn = wrds.Connection()
ccm = conn.raw_sql("""
select gvkey, lpermno as permno, lpermco as permco, linktype, linkprim,
linkdt, linkenddt
from crsp.ccmxpf_linktable
where (linktype ='LU' or linktype='LC')
and linkprim in ('P', 'C') and usedflag=1
""", date_cols=['linkdt', 'linkenddt'])
But when I run the step to link CRSP and Compustat, it didn't work.I guess my account doesn't have the permission to visit CCM database.
So, anyone could help me run the code or tell me how to get the same result without CCM.
Thank you so much.
Your code runs for me. If it does not run for you, then you must not have access to CRSP on WRDS. I don't believe there is a separate subscription for CCM. (To rule out issues with the
wrds
module on your computer, you should check that you can run code for data that you know you have access to.)There is no way to "get the same result without CCM" (see here for details).