***************************************************************************
Replication Package for

	*** Internalizing Peer Firm Product Market Concerns: Supply Chain Relations and M&A Activity***
		by Farzana Afrin, Jinhwan Kim, Sugata Roychowdhury & Benjamin P. Yost  
		(Journal of Accounting Research, 2024) 
		

***************************************************************************
Table of Contents
	*I:   Codes for downloading raw data
	*II:  Codes for taking raw data to final datasets used in analyses
	*III: Codes for statistical and econometric analyses
	*IV:  Identifiers of observations used in analyses

***************************************************************************
I: Codes for downloading raw data
	*I.a. The SAS code "0_Get_raw_data.sas" 
		- downloads compustat data
		- downloads compustat segment data
		- links compustat segment data to identifiers from linking table
		- Prepares M&A dataset 
		- Downloads institutional ownership data
	
***************************************************************************
II: Codes for taking raw data to final datasets used in III.
	*II.a. The Stata code "1_X_var_construction.do" 
		- Calculates the various measures of competition concerns of the customers
		- Creates supplier firm-year level independent variable of interest
	*II.b. The SAS code "2_ Y_var_construction.sas"  
		- Identifies customer rivals using 3-digit SIC code within the compustat universe
		- Identifies suppliers of customer rivals using the customer relationships in compustat segment universe
		- Identifies set of M&As that are with customer rivals or their suppliers
	*II.c. The SAS code "3_Controls&CS_vars_construction-Part 1.sas" 
		- Creates controls and cross sectional variables (joint ventures, relationship length, R&D, patents, trade secrets, and redaction)
		- Creates customer switch dataset
		- Creates common ownership dataset
		- Merge in common ownership, customer switch, M&A data with the supplier firm-year level dataset
	*II.d. The Stata code "3_Controls&CS_vars_construction-Part 2.do" 
		- Creates tech class to NAICS cross walks
		- Creates cross sectional variables (technological similarity)
		- Creates Customer level controls
		- Creates vertical relatedness dataset for the falsification test
		- Creates dataset for rival weighted customers' comp concerns
	*II.d. The Stata code "4_ Final_dataset_construction.do" 
		- Merges customer level controls to our main dataset
		- Merges cross sectional variables to our main dataset
		- Merges vertical relatedness dataset to our main dataset
		- Merges dataset for rival weighted customers' comp concerns to our main dataset
		- Renames, creates logarithms, winsorizes, and excludes missing values

***************************************************************************
III: Codes for statistical and econometric analyses
	*III.a.	The file "5_AKR_regressions.do" contains all the statistical analyses to generate the tables and figures	


***************************************************************************
IV: Identifiers of observations used in analyses
	*IV.a.	The file "firmids.dta" contains the full list of supplier gvkeys used in our analyses.
	*IV.b.	The file "dealids.dta" contains the full list of vertically conflicted mergers used in our analyses.