About Me

Hi, I’m Kai CUntitledhen, an assistant professor in Accounting at Wilfrid Laurier University. I created this website when I was a PhD student at the University of Waterloo. This website serves as a repository for coding tips and SAS/Stata/Python programs for archival research in financial accounting. I personally benefit a lot from other persons’ blogs or websites. I hope I can use my expertise to help others in return.

I wish this website can promote code transparency and reusability in our community.

I like running (finished my first half marathon on May 1, 2016), photography, videography, astronomy, programming, website building, and all cool tech gadgets. If I were not in the field of accounting (auditor and financial advisor at Big 4, accounting PhD and now professor), I would probably have been a good programmer.

Happy coding, and share!

18 Responses to About Me

  1. Dennis Coppens says:

    Hi Kai,

    Thank you for the explanation on exporting files from Factiva in a table format. That is exactly what I need to do for my current work.

    Unfortunately, I have never worked with Python, so it gets very complicated very fast for me. How I understood it, I simply paste the code you wrote in Python, while having my txt files in the same folder as Python, and it should automatically do the trick. I think I may be oversimplifying it a little! Could you possibly give some advice to send me in the right direction. I would be very grateful!

    Many thanks,
    Dennis Coppens

  2. Jun Gu says:

    Hi Kai,

    Thanks very much for your sharing on codes and experience of data processing. During my PhD study, I also benefited quite a lot from online resources, e.g. WRDS forum, some blogs, perosnal sites from some scholars like Andrew Lo. It is really nice to spot your blog with so many key information on. Thanks again for your site.

  3. garen says:

    Hey Kai! Many thanks in sharing your code. This is the most helpful page!

    Wish you a great day, Garen

  4. Razoo says:

    vDear Chen,

    Thank you very much for the code.

    Could you please post a code for linking between compustat and audit analytics without CRSP and I/B/E/S?

    Thank you very much again,

  5. Won says:

    Hello Chen,

    Thank you very much for your efforts in promoting accounting research transparency.
    It is impressive!

  6. Sabrina says:

    Hi Kai

    It is nice to see you post and it is very helpful. Can you please post a python code to directly read IBES from WRDS and compute some popular variables, such as monthly revisions of each stock, etc? Thank you!

  7. Amanda says:

    Hi Kai,

    I really appreciate your sharing of the SAS code. I tried to replicate Easton (2004) cost of equity, but my result is not close to 13%. Could you please send me a code for the calculation? Any hint is appreciated!

  8. Felix Acquah says:

    Hi Kai-
    Happy New Year. I am conducting an event study and wondering if I could talk to you offline about my research and get your expertise on overall approach. I look forward to hearing from you. Thanks, Felix.

  9. nishant says:

    Hi Kai,
    Is there a macro in SAS for the global Event Study suite in WRDS?

  10. Lida says:

    Hi Kai,

    I came across your website when searching for the effective way to extract news from Factiva, but I am totally new to Python. I was wondering if you could give some advice on the process and coding. Do I have just copy the codes or I have to modify them? I will use them later for sentiment analysis using dictionary approach, and also for other analysis. I am not sure which version of Python that I need.

    Thank you so much.


  11. Ali Malik says:

    Hi Professor. This is the first time I am using WRDS. I am trying to merge crsp/compustat data using ccm. Kindly check the steps I am following and provide further guidance. 1 ) I use CCM online web query to download compustat data with LPREMNO in Stata or as a CSV file. 2) I use CRSP web query to dowload the stock data.3) I merge the two together using LPREMNO. Kindly confirm the steps are correct and how do I merge in the 3rd step in Stata or SAS with my files. If possible can you please share the code for doing so.

    • Kai Chen says:

      The three steps are fine. However, using Stata to do step 3 is painful, and also unreliable, because you probably will use m:m merge and m:m merge in Stata is not reliable (Stata’s official manual admits this). The best way to do step 3 is using a software package that supports SQL, e.g., SAS. Although some successful researchers solely use Stata, I do recommend you learn to use SAS to do SQL. This will improve your efficiency greatly. You can read another post for more details at http://www.kaikaichen.com/?p=33.

  12. Vincent says:

    What you do is great! Thanks for sharing. Hope I can help in the future.

  13. Yuping says:

    Hi Professor Chen,thank you very much for sharing the codes and experience! Hope I can contribute one day. 😊

  14. xuan peng says:

    Hi Kai, i just wanted to say thank you for sharing codes. These are truly helpful for my study and research.

  15. Eric Liu says:

    Hey Kai,
    Would like to connect you on LinkedIn: linkedin.com/in/ericjintaoliu.
    We are developing a use case Python for Finance and would like to use SEC Edgar data: https://www.sec.gov/dera/data/financial-statement-data-sets.html
    I have a couple questions to ask you and seek partnership in delivering this course.
    Eric (647)521-6699

  16. Sophia says:

    Dear Kai,

    Thank you very much for creating such a useful web page with your programming codes. They are super helpful.
    But I am just having one dumb question regarding this post “SAS macro to get analysts EPS consensus for a given fiscal period end (DATADATE) by a selected date (DATE)” – I am not sure what “a selected data (DATE)” means in this whole program. I am wondering if you would mind clarifying that a little bit (as I am struggling in creating the INFLIE)?

    Thank you very much for your time and help.

Leave a Reply to Yuping Cancel reply

Your email address will not be published. Required fields are marked *