The following provides instructions on running the code contained in this repository. The repository contains the SAS, Python, and Stata code used to create the tables.

I have separated the code files into directories based on the task and the order in which they need to be run. Once the data is downloaded, I use the batch file "run_all_files.bat" to run all of my code files. You can view the order in which the files should be run in that file. the "logs" directory contains a comprehensive log file created by "run_all_files.bat" and individual log files created by each individual code file.

Data that are not explicitly downloaded in the code below were downloaded via WinSCP from WRDS or the data provider's website as specified in the paper.

1. "0_Download_CIQ_Transcripts"
    a. I download the CapitalIQ transcript data files from WRDS and store them in a local SQL database. This data needs to be downloaded before running the code in the directories below.
2. "0_Classify_Q_A"
    a. I identify the sample of earnings call transcripts and classify answers as non-answers. 
    b. I obtain the lengths of the Q&A sessions and answers
3. "1_classsify_analysts"
    a. I classify analysts and merge I/B/E/S recommendations with the CapitalIQ transcripts data. 
4. "2_process_merge"
    a. I create the variables needed in each of my samples (earnings calls, management forecasts, and restatements) and merge the datasets as needed
5. "3_tables_figures" 
    a. I clean the data to create the final samples, then run and tabulate the tests.
    b. After these code files are run, I create Figure 2 by transposing the resulting table in "MF Resposne Coefficient.xlsx" and plotting Engagement quintiles on the x-axis and the average response coefficient on the y-axis of a line chart within Excel.

The code files are run sequentially, beginning with the directory with the lowest leading number. Within each directory, each script is run starting with the lowest leading number. Scripts without a leading number are supporting code files and do not need to be run individually.

You will notice that some log files reference errors that are not in the same log file. These errors relate to missing observations or insufficient observations for a proc reg or proc expand procedure. These procedures result in missing values which are dropped in later stages. The log output for these procedures are quite large. To prevent the main log files from becoming too cumbersome, I printed those portions of the log to "junk" log files titled:  "proc_expand_junk.log", "proc_expand_junk1.log", and "proc_reg_junk.log".

if "run_all_files.bat" is run from the command line when the current directory is "code", each file will run as needed. Each file can also be run individually. You may need to redefine directory paths to conform to your directories. Before executing, "run_all_files.txt" must be renamed to "run_all_files.bat".

The "identifiers" directory contains the CSV files with the identifiers (firms, dates, and analysts) for the final datasets used for the final tests in Stata (2_Run_Tests.do). For quarterly data related to managers' engagement with unfavorable analysts, see my personal website at https://jaredflake.com/code_data/.

All errors are my own. For questions, reach out to jaredflake@boisestate.edu.