Hi
I have a dataset that gathers information about firms (number of employees, tunrover, sales, long-term debt etc..).
I want to divide for each year sales in categories (let's say every 100 000 euros) and in each of these categories, I want to look at the mean debt. So the firms have to be divided into subsets depending on their sales so that I can compute the mean debt and compare it with the mean of the other groups.
Here is what I did, but the results are not what I should get when I look at a subset :
forvalues i=2004/2009 {
egen sales_cat_`i'=cut(sales) if sales<100000, at(-31000, -30900 to 100000)
foreach x in sales_cat_`i' {
egen mean_LT_debt_`i'=mean(long_term_debt)
gen mean_lt_debt_to_sales_cat_`i'=(mean_LT_debt_`i')/sales_cat_`i'
clear
}
}
Where did I go wrong ?
Manon
I have a dataset that gathers information about firms (number of employees, tunrover, sales, long-term debt etc..).
I want to divide for each year sales in categories (let's say every 100 000 euros) and in each of these categories, I want to look at the mean debt. So the firms have to be divided into subsets depending on their sales so that I can compute the mean debt and compare it with the mean of the other groups.
Here is what I did, but the results are not what I should get when I look at a subset :
forvalues i=2004/2009 {
egen sales_cat_`i'=cut(sales) if sales<100000, at(-31000, -30900 to 100000)
foreach x in sales_cat_`i' {
egen mean_LT_debt_`i'=mean(long_term_debt)
gen mean_lt_debt_to_sales_cat_`i'=(mean_LT_debt_`i')/sales_cat_`i'
clear
}
}
Where did I go wrong ?
Manon
Comment