Hello,
I have a panel data set with thousands of firms, firm ID, date for end of accounting year (time variabel), total assets and cash. The data set is in long format.
I want to exclude (not drop from the data set) the whole firm if one or more values of either total assets or cash (or both) is missing in the time period of 2005-2010. I have yearly data.
I have tried to generate a variabel which is = 1 if: bysort ID: gen OK = 1 if total_assets != . & cash != . & years_data > 9. The latter variabel is generated as: bysort ID: gen years_data = [_N].
However, when i look at the column i have created, I see that it includes several firms and don't drop the whole firm as i wish.
So, the main question is: how can I exclude the entire firm from further calculations if one or more values of total assets and/or cash is missing between year 2005-2010?
Thank you in advance
I have a panel data set with thousands of firms, firm ID, date for end of accounting year (time variabel), total assets and cash. The data set is in long format.
I want to exclude (not drop from the data set) the whole firm if one or more values of either total assets or cash (or both) is missing in the time period of 2005-2010. I have yearly data.
I have tried to generate a variabel which is = 1 if: bysort ID: gen OK = 1 if total_assets != . & cash != . & years_data > 9. The latter variabel is generated as: bysort ID: gen years_data = [_N].
However, when i look at the column i have created, I see that it includes several firms and don't drop the whole firm as i wish.
So, the main question is: how can I exclude the entire firm from further calculations if one or more values of total assets and/or cash is missing between year 2005-2010?
Thank you in advance

Comment