Categories
 Data (7)
 Learning Resources (8)
 Python (7)
 SAS (11)
 Stata (14)
 Uncategorized (2)

Recent Posts
 The calculation of average credit rating using ratings from three rating agencies
 Stata commands to test equality of mean and median
 Handy Stata command to display combined Pearson and Spearman correlation matrix
 Stata command to convert string GVKEY to numerical GVKEY or vice versa
 Stata command to calculate the area under ROC curve
Recent Comments
 Joe on Calculate idiosyncratic stock return volatility
 Sabrina on About Me
 Jixun on Calculate market value of equity: use CRSP or Compustat?
 Hui on A loop of crosssectional regressions for calculating abnormal accruals in Stata
 Shuo Wang on The calculation of average credit rating using ratings from three rating agencies
Archives
Meta
Author Archives: Kai Chen
Sample code for “outreg” command in Stata
outreg is very powerful and timesaving command in Stata. The following code generates a readyforuse results table:
1 2 3 4 5 
outreg, stats(b p) sdec(3) /// summstat(r2_a \ N) summdec(3,0) summtitles("Adjusted R2" \ "N") /// starlevels(10 5 1) starloc(1) /// ctitles("", "Heading" \ "", "Subheading") /// keep(_cons x1 x2 x3 x4) 
Please change x1, x2, x3 and x4 to variables that you want to report.
Posted in Stata
Leave a comment
Use Python to download data from the DTCC’s Swap Data Repository
I helped my friend to download data from the DTCC’s Swap Data Repository. I am not familiar with the data and just use this as a programming practice. This article gives an introduction to the origin of the data: http://www.dtcc.com/news/2013/january/03/swapdatarepositoryrealtime The … Continue reading
Posted in Data, Python
Leave a comment
Download FR Y9C data from WRDS
WRDS currently populates FR Y9C data quarter by quarter in individual datasets, like BHCF200803, BHCF200806, BHCF200809 and so on. WRDS has not stacked those individual datasets to formulate a single timeseries dataset like COMPUSTAT. There are two ways to overcome … Continue reading
Posted in Data, SAS
2 Comments
TARStyle Word Template
I create a Word template that complies with The Accounting Review editorial style. My design philosophy is “simple but sufficient”. I do not like those templates that are heavy and fancy (e.g., macros everywhere). This is just version 1. It … Continue reading
Posted in Uncategorized
1 Comment
Use Python to download TXTformat 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
42 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 crosssectional regressions for calculating abnormal accruals in Stata
I write a loop of crosssectional 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
7 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
Rollingwindow computation in SAS and Stata
SASers often find proc expand plus transformout very useful for rollingwindow (or movingwindow) 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