This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc sql; | |
create table out.sp500 as | |
select distinct a.permno, a.date, | |
a.permco, | |
c.ncusip as CUSIP, | |
c.exchcd, | |
c.tsymbol, | |
c.shrcls | |
from crsp.msf a, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl to get all of the zip files of PDFs | |
curl https://www.sec.gov/foia/docs/adv/formadv_part2_[1-112].zip -o "/data/hue/adv2/formadv_part2_#1.zip" | |
# list files | |
unzip -l formadv_part2_1.zip | |
# awk extract the part I care about | |
unzip -p formadv_part2_100.zip 103705_325511_1_20200131.pdf | pdftotext - - | awk 'BEGIN{IGNORECASE=1};/^item 11/,/^item 12/' | |
# build an index | |
for f in *.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract.bife <- function(model) { | |
s <- summary(model) | |
names <- rownames(s$coefmat_beta) | |
co <- s$coef[, 1] | |
se <- s$coef[, 2] | |
tstat <- s$coef[, 3] | |
pval <- s$coef[, 4] | |
aic <- s$AIC | |
bic <- s$BIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The goal of this code is to identify all gvkeys in Compustat, | |
and to estimate approximate start/end dates for these gvkeys */ | |
proc sql; | |
/* All NA Companies */ | |
create table comp_name_range as | |
select * | |
from | |
/* Company files contains all NA gvkeys */ | |
(select gvkey, ein, cik, | |
UPCASE(COMPBL(PRXCHANGE('s/[\W_]+/ /',-1,conm))) as conm, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*******************READ ME********************************************* | |
* - Macro to download and parse the Fama French Factors - | |
* | |
* SAS VERSION: 9.4.0 | |
* DATE: 2014-03-06 | |
* AUTHOR: eddyhu at the gmails | |
* | |
****************END OF READ ME******************************************/ | |
%macro GET_FFDATA(file=F-F_Research_Data_Factors, | |
dsetout=ff_factors, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*******************READ ME********************************************* | |
* - Macro to Helmert transform (forward mean-difference) panel data - | |
* | |
* SAS VERSION: 9.4.0 | |
* DATE: 2013-05-05 | |
* AUTHOR: eddyhu at the gmails | |
* | |
****************END OF READ ME******************************************/ | |
%macro HELMERT(dsetin = &syslast., |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.