Use Python to download TXT-format SEC filings on EDGAR (Part II)

As I said in the post entitled “Part I“, we have to do two steps in order to download SEC filings on EDGAR: Find paths to raw text filings; Select what we want and bulk download from the EDGAR FTP server using … Continue reading

Posted in Data, Python | 35 Comments

Use Python to extract Intelligence Indexing fields in Factiva articles

First of all, I acknowledge that I benefit a lot from Neal Caren’s blog post Cleaning up LexisNexis Files. Thanks Neal. Factiva (as well as LexisNexis Academic) is a comprehensive repository of newspapers, magazines, and other news articles. I first … Continue reading

Posted in Python | 8 Comments

A loop of cross-sectional regressions for calculating abnormal accruals in Stata

I write a loop of cross-sectional regressions for calculating abnormal accruals. This program can be easily modified and replaced with Jones, modified Jones, or Dechow and Dichev model. I add detailed comments in the program to help you prepare the input … Continue reading

Posted in Stata | 6 Comments

The impact of WRDS transition to the new WRDS Cloud server

WRDS has quietly started the transition from the old server to the new Cloud server. This move makes a lot of support documentation on the WRDS website outdated and misleading. That is why I think WRDS should direct its resources on continuously … Continue reading

Posted in Learning Resources, SAS | 1 Comment

Rolling-window computation in SAS and Stata

SASers often find proc expand plus transformout very useful for rolling-window (or moving-window) computation. Stataers may wonder if there is a counter party in Stata. The answer is “yes”. The command in Stata is rolling. See the manual below: http://www.stata.com/manuals13/tsrolling.pdf The … Continue reading

Posted in Learning Resources, SAS, Stata | Leave a comment

SAS macro for event study and beta

There are two macros on the List of WRDS Research Macros: EVTSTUDY and BETA, which may be often used. I like the first one, written by Denys Glushkov. Denys’ codes are always elegant. I don’t like the second one because … Continue reading

Posted in SAS | 1 Comment

Pipeline

These are some topics in my mind. I will write up when I have time. Use Python to remove boilerplate paragraph in firm-initiated press releases Calculate earnings surprises Chow test and Vuong test Access to WRDS Propensity score matching macros … Continue reading

Posted in Uncategorized | Leave a comment

Use Python to calculate the tone of financial texts

I find two internet resources for this task (thank both authors): https://iangow.wordpress.com/2014/07/22/get-tone-from-corporate-disclosures-postgresql-python-and-r/ http://conjugateprior.org/software/ca-in-python/ The first solution is way more efficient than the second, but the second is more straightforward. The first needs extra knowledge of PostgreSQL and R besides Python. I … Continue reading

Posted in Python | 5 Comments

How to remove duplicate GVKEY-DATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ)?

The annual data is easy to deal with, you just need to add conditions as follows: indfmt==”INDL” & datafmt==”STD” & popsrc==”D” & consol==”C” If you have downloaded FUNDA and converted it into Stata format, the uniqueness of GVKEY-DATADATE can be … Continue reading

Posted in Learning Resources | 4 Comments

If beginning year and ending year are known, how to fill in years in between?

Question: Suppose two companies A and B are connected in some years. Say, right now the data structure is the following: Company 1 Company 2 Starting Year Ending Year A B 2000 2006 A C 1998 2003 C D 1995 … Continue reading

Posted in SAS | Leave a comment