S&P 500 Constituents
This code illustrates how to get historical S&P 500 index constituents and their identifiers from CRSP and Compustat.
- Researchers used to be able to extract index membership information from Compustat's "comp.idxcst_his" data. Now that S&P pulled this piece of data off from WRDS platform, we have to turn to CRSP to get S&P 500 Index membership data.
- Unfortunately, there is no easy way to uncover constituents info for the other indices covered by "comp.idxcst_his".
- Import Python packages and connect to WRDS
2. Get S&P 500 Index Membership from CRSP
- I opt for the monthly frequency of the data, but one can choose to work with crsp.dsp500list if more precise date range is needed.
3. Add Other Company Identifiers from crsp.msenames
- You don't need this step if only PERMNO is required
- This step aims to add TICKER, SHRCD, EXCHCD and etc.
4. Add Compustat Identifiers
- Link with Compustat's GVKEY and IID if need to work with fundamental data
- Linkage is done through crsp.ccmxpf_linktable