NAME_HISTORY. This table contains information on identifiers such as
CUSIP, as well as other codes. The start date (column
NAMEDT) and end date (column
NAMEENDDT) define the period for which a particular stock identifier was valid. If
NAMEENDDTis not available, this means that the stock data in
NAME_HISTORYis still accurate until the most recent date in the dataset.
CUSIPidentifiers to merge it with the table
NAME_HISTORYin CRSP. Merging based on the
CUSIPidentifier requires dates from COMPUSTAT and CRSP to fall within the time interval defined by
LINK_HISTORY) that can be used to merge CRSP with COMPUSTAT with the following information:
GVKEYfor companies or
PERMNOlink during link period.
PERMCOlink during link period.
LINKENDDTis null, this means that the link is still effective.
PERMNO. If merging COMPUSTAT with CRSP-COMPUSTAT, then the join is done based on
GVKEY. When merging the first dataset with CRSP-COMPUSTAT, both identifiers of CRSP (
PERMNO) and COMPUSTAT (
GVKEY) will be present in the output table.
GVKEY. Otherwise, merge it with CRSP on
MSF(Monthly price information)
FUNDAalong with the important identifiers
DATADATE. It is important to note that the result of a naive query might contain some duplicate
DATADATEcombinations that need to be deduplicated.
INPis just the result of the previously presented query. This is joined together based on
GVKEYwith the linking table. Some care is needed, due to the fact that a link between a
PERMNOcan be transient - hence the linking happens only for timestamps that fall in the linking period. More complicated logic can be implemented using overlap intervals. For the appropriate choice of
LINKTYPE, consult the dataset documentation, the present version is a standard choice.
PERMNOmatches for a
GVKEY. This is easiest to be done using the previously presented syntax in R, however, this involves the drawback of not being able to run later join operations using the database engine.
MSFtable contains monthly pricing information and the bid/ask average
PRCis queried in this toy example.
CO_AFND1tables are available in the working instance's current state.