Hi everyone,
I am currently working on my bachelor thesis.
I want to delete all the zeros at the end of each time-series.
I have a variable Name containing the name of the company. I have a variable mofd containing the month (in Stata language) and i have a variable returns, containing the returns for each company in each month.
I have panel data containing values with zero. I wish to drop any observations at the end of each panel containing just values with zero. How do I do this?
So more specific. I am looking at monthly stock returns for different companies. I use the timeframe 01-01-2013 till 01-05-2022. If a company's returns equals zero at the end of the time-series it means a company got delisted. I want to keep the zeros at the beginning and middle of the panel, but delete the zeros at the end. So starting at the end and checking if a value contains a zero and then deleting it. Then looking one month before that and doing the same. But nog deleting for instance a zero in month 01-04-2022 when 01-05-2022 contains a numeric value which is not zero. So that for every company the latest value is a 'real value' and not zero.
If this is not clear enough, I want to what they did on this Stata page, but then delete zeros at the end instead of missing values.
https://www.stata.com/support/faqs/d...issing-values/
I hope you can help me.
Bibi
I am currently working on my bachelor thesis.
I want to delete all the zeros at the end of each time-series.
I have a variable Name containing the name of the company. I have a variable mofd containing the month (in Stata language) and i have a variable returns, containing the returns for each company in each month.
I have panel data containing values with zero. I wish to drop any observations at the end of each panel containing just values with zero. How do I do this?
So more specific. I am looking at monthly stock returns for different companies. I use the timeframe 01-01-2013 till 01-05-2022. If a company's returns equals zero at the end of the time-series it means a company got delisted. I want to keep the zeros at the beginning and middle of the panel, but delete the zeros at the end. So starting at the end and checking if a value contains a zero and then deleting it. Then looking one month before that and doing the same. But nog deleting for instance a zero in month 01-04-2022 when 01-05-2022 contains a numeric value which is not zero. So that for every company the latest value is a 'real value' and not zero.
If this is not clear enough, I want to what they did on this Stata page, but then delete zeros at the end instead of missing values.
https://www.stata.com/support/faqs/d...issing-values/
I hope you can help me.
Bibi
Comment