Categories
- Data (9)
- Learning Resources (9)
- Python (9)
- SAS (14)
- Stata (24)
- Uncategorized (1)
-
Recent Posts
Recent Comments
- carlos rivas on Use Python to download lawsuit data from Stanford Law School’s Securities Class Action Clearinghouse
- Kai Chen on Stata command to create Fama-French industry classifications based on SIC codes
- Kai Chen on Stata command to create Fama-French industry classifications based on SIC codes
- Philippe Dubois on Stata command to create Fama-French industry classifications based on SIC codes
- carlos rivas on Use Python to download lawsuit data from Stanford Law School’s Securities Class Action Clearinghouse
Archives
- February 2022
- January 2022
- August 2021
- March 2021
- September 2019
- August 2019
- July 2019
- May 2019
- April 2019
- March 2019
- August 2018
- July 2018
- December 2017
- November 2017
- October 2017
- September 2017
- April 2017
- September 2016
- April 2016
- December 2015
- November 2015
- September 2015
- August 2015
- June 2015
- March 2015
- February 2015
Meta
Author Archives: Kai Chen
Link FactSet and CRSP
Both FactSet and CRSP have identifier files that contain primary identifiers at the entity level and the security level (note: an entity may issue multiple securities) and provide a map between their primary identifiers and all other historical identifiers (e.g., … Continue reading
Posted in Data
4 Comments
A test on Stata running speed on MacBook Pro (M1 Pro chip) and old Macs
I ran a test on Stata running speed on my newest MacBook Pro (14-inch, 2021) and two old Macs—iMac (27-inch, 2019) and MacBook Pro (16-inch, 2019). Technical specifications: MacBook Pro (14-inch, 2021): CPU Apple M1 Pro (10-core), memory 16G, SSD … Continue reading
Posted in Stata
6 Comments
My thoughts on Python for accounting research
There is a temptation for accounting PhD students to invest in learning Python. However, I would recommend accounting PhD students focus more on SAS + Stata than on Python in their first year for a few practical and technical reasons: … Continue reading
Posted in Learning Resources, Python
1 Comment
Use Stata to do propensity score matching (PSM)
Most propensity score matching (PSM) examples are using cross-sectional data instead of panel data. However, accounting research often uses panel data (i.e., observations with two subscripts i and t, e.g. firm-years) in a difference-in-differences (DID) research design, so that there are … Continue reading
Posted in Stata
4 Comments
Export a SAS dataset to Stata with all variable names converted to lowercase
I use both SAS and Stata and often need to transfer data between the two. SAS is case-sensitive and Stata is not. I always prefer working with lowercase variable names in Stata. The following code is used to export a … Continue reading
Posted in SAS
3 Comments
Clean up TRACE Enhanced dataset
WRDS provides an excellent manual (link) and SAS code (link) for cleaning up the raw TRACE Enhanced bond transaction data, primarily based on the work done by Dick‐Nielsen, Jens, How to Clean Enhanced TRACE Data (December 3, 2014). Available at … Continue reading
Posted in SAS
Leave a comment
Stata command to perform Chow test
A Chow test is simply a test of whether the coefficients estimated over one group of the data are equal to the coefficients estimated over another. I find two useful articles from Stata’s official website: Can you explain Chow tests? … Continue reading
Posted in Stata
5 Comments
SAS macro to count the number of analysts following a firm
This macro is used to count the number of analysts who followed a specific firm. Although this is a commonly used measure in literature, prior studies often give a vague description on what they do. The question is—what does “analysts … Continue reading
The art of regular expression
Regular expression is a powerful tool to do text search. It is the foundation of a lot of textual analysis research, though today’s textual analysis in computer science has gone far beyond text search. Regular expression operations are programming language … Continue reading
Stata commands to change variable names or values of string variables to all lowercase
Stata is a case-sensitive application. Sometimes this will cause a trouble. So, we may want to change variable names or values of variables to all lowercase before we start processing data. This post gives a fast way to do this. … Continue reading
Posted in Stata
2 Comments