Hi @mkeintz, your help is greatly appreciated! The code seems to work in general but there are a few issues I cannot resolve. That's what my output looks like: gvkey is my id and length corresponds to size. 1. The cells marked in yellow contain the same id, which shouldn't be the case, right? 2. I do know what the maximum length of a subseries is, but I do not know when it starts and when it ends. 3. How do I transfer the information I got in this step to my original data set, which contains all my observations with quarterly cash flows. Somehow I now need to delete all the sub-series in my original data set that are not the longest of a firm. Once I managed this, I can proceed with the output. Maybe you have another idea on how to tackle this. Thanks again for all the help! Best, Waynerun
... View more