| link_ccm | R Documentation |
Downloads the CCM (CRSP-Compustat Merged) linking table that maps CRSP PERMNOs to Compustat GVKEYs with valid date ranges.
link_ccm(
wrds,
linktype = c("LC", "LU", "LS"),
linkprim = c("P", "C"),
n = Inf,
lazy = FALSE
)
wrds |
A |
linktype |
Character vector. Types of links to include.
Defaults to
|
linkprim |
Character vector. Link primacy filters.
Defaults to
|
n |
Maximum number of rows to return. Defaults to |
lazy |
If |
The linking table comes from crsp.ccmxpf_lnkhist. Missing linkenddt
values indicate ongoing links and are replaced with the maximum date in the
table for easier date-range joins.
To use the link, join on gvkey and ensure your observation date falls
within the linkdt to linkenddt range.
A tibble with columns:
Compustat company identifier
CRSP permanent security identifier
Start date of the link
End date of the link (missing values replaced with max date)
Type of link
Link primacy
Ian Gow, Financial Accounting Research, Chapter on Identifiers: https://iangow.github.io/far_book/identifiers.html
get_compustat()
## Not run:
wrds <- wrds_connect()
ccm <- link_ccm(wrds)
# Join with Compustat data
compustat <- get_compustat(wrds)
compustat |>
dplyr::inner_join(ccm, by = dplyr::join_by(gvkey)) |>
dplyr::filter(datadate >= linkdt, datadate <= linkenddt)
wrds_disconnect(wrds)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.