-
Categories
- Data (9)
- Learning Resources (9)
- Python (8)
- SAS (13)
- Stata (26)
Archives
- September 2023 (1)
- August 2023 (1)
- May 2023 (1)
- February 2022 (2)
- January 2022 (1)
- August 2021 (1)
- September 2019 (1)
- August 2019 (2)
- July 2019 (2)
- May 2019 (1)
- April 2019 (1)
- March 2019 (1)
- August 2018 (3)
- July 2018 (4)
- December 2017 (1)
- November 2017 (1)
- October 2017 (1)
- September 2017 (1)
- April 2017 (2)
- September 2016 (1)
- April 2016 (1)
- December 2015 (1)
- November 2015 (1)
- September 2015 (4)
- August 2015 (5)
- June 2015 (3)
- March 2015 (7)
- February 2015 (2)
Author Archives: Kai Chen
How to prevent the “log file already open” error when working with log files in Stata
Sometimes we use the log using filename, replace command at the beginning of a Do file to open a log file and record everything displayed in the Results window. However, if an error interrupts the previous execution of the Do … Continue reading
Stata command to draw a graph showing the average of a variable by group
Suppose we have the following dataset that provides the life expectancy (lexp) of each country in each region: We can draw a bar graph to show the average (or other statistics) life expectancy of each region using two different methods: … Continue reading
Stata command to rename groups of variables
Swap variable names: rename (v1 v2) (v2 v1) Lowercase (or uppercase, or propercase) groups of variable names: rename V1 V2, lower or rename *, lower Add suffix _old to variables v1, v2, … for one or more digits: rename v# … Continue reading
Link FactSet and CRSP
Both FactSet and CRSP offer identifier files that contain primary identifiers at the entity level and security level (note: an entity may issue multiple securities). These files provide a mapping between their primary identifiers and all other historical identifiers such … Continue reading
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 that accounting PhD students focus more on SAS + Stata than on Python in their first year for a few practical and technical … Continue reading
Stata command to perform propensity score matching (PSM)
Most propensity score matching (PSM) examples typically use cross-sectional data rather than panel data. However, in accounting research, panel data (observations with two subscripts i and t, e.g., firm-years) are often used in a difference-in-differences (DID) research design. This involves … Continue reading
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
6 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
Posted in SAS
2 Comments