Hi, I'm actually a bit confused about the difference between calculating the average of firms in each industry for each year where the CSO presence variable equals 1 and calculating the percentage. In the code below, I calculated the percentage of firms in each industry per year with a CSO presence equal to 1. Can you help clarify how to compute the average instead?
This is the way i calculated the The percentage of firms in each industry in each year where the cso presence variable is equal to 1
* drop if industry identifier is missing
drop if SIC_WRDS_2 == .
keep if year >= 2004 & year <= 2022
* Count the number of firms in each industry in each year where the cso presence variable is equal to 1
capture bys SIC_WRDS_2 year : egen Instrumental_based_on_CSO_Count = count(csopresence1 / (csopresence1==1))
* Count the total number of firms in each industry and each year where cso is not missing
bys SIC_WRDS_2 year : egen total_firms_industry_year = count(csopresence1)
* The percentage of firms in each industry in each year where the cso presence variable is equal to 1
gen CSO_Percentage = Instrumental_based_on_CSO_Count / total_firms_industry_year
can you help clarify how to compute the average of firms in each industry in each year where the cso presence variable is equal to 1
This is the way i calculated the The percentage of firms in each industry in each year where the cso presence variable is equal to 1
* drop if industry identifier is missing
drop if SIC_WRDS_2 == .
keep if year >= 2004 & year <= 2022
* Count the number of firms in each industry in each year where the cso presence variable is equal to 1
capture bys SIC_WRDS_2 year : egen Instrumental_based_on_CSO_Count = count(csopresence1 / (csopresence1==1))
* Count the total number of firms in each industry and each year where cso is not missing
bys SIC_WRDS_2 year : egen total_firms_industry_year = count(csopresence1)
* The percentage of firms in each industry in each year where the cso presence variable is equal to 1
gen CSO_Percentage = Instrumental_based_on_CSO_Count / total_firms_industry_year
can you help clarify how to compute the average of firms in each industry in each year where the cso presence variable is equal to 1
Comment