-
All in SAS
-
A python version is here
EquityCharacteristicsSAS
Calculate US equity (portfolio) characteristics.
The main file is in SAS.
To use this preoject, you need access to WRDS (CRSP, COMPUSTAT, IBES). As for computing system, I use WRDS cloud server.
Details
chars folder
This folder is to calculate equity characteristics in individual level.
The most important part is accounting, which is modified from Green Han Zhang 2017 RFS code. Then, rvar_mean is for stock total variance, rvar_capm is residual variance based on CAPM, rvar_ff3 is residual variance based on Fama French three-factor model, beta is for CAPM beta, abr sue re is from Hou Xue Zhang’s Replicating Anormalies.
In combine, I combine the tables. In output, I do winsorization. In imputation, I fill-in the missing values in individual characteristics with FFI49 Industry Median, if still missing, then fill-in with all stock median. In rank, I give a standardized version of the variables in uniform distribution.
You may run the sas files in the following order:
- parallel: accounting, rvar_mean, rvar_capm, rvar_ff3, beta, abr, sue, re
- combine
- output
- Imputation
- rank
sortport
This folder is to calculate equity characteristics in portfolio level.
We provide 3 kinds of portfolios:
- Fama French Industry Classification
- Sorted portfolio (2x3 1x10 5x5)
- DGTW benchmark portfolio
We assign the portfolio labels to each equity in each month, then calculate the portfolio characteristics as the value-weighted (equal-weight) mean (median) of the underlying equities.
Reference
Dissecting Anomalies with a Five-Factor Model by Fama and French 2015 RFS
The Characteristics that Provide Independent Information about Average U.S. Monthly Stock Returns by Green Hand Zhang 2017 RFS
Replicating Anormalies by Hou Xue Zhang 2018 RFS
Contact
Xin He
xinhe9701@gmail.com
www.xinhesean.com