Dear Statalisters,

I am currently working on my Master Thesis and thus I analyze company financials over the years 2008 to 2017.

Unfortunately, I am struggling with companies having gaps in their reported data.

1st Company Example
Code:
      | ID                                      Companyname   Year      Sales |
      |-----------------------------------------------------------------------|
  27. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2010   47642000 |
  28. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2012   41569000 |
  29. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2013   37675000 |
  30. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2014   33806000 |
  31. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2015   41554000 |
      |-----------------------------------------------------------------------|
  32. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2016   46360000 |
  33. |        5   BETA SYSTEMS SOFTWARE AKTIENGESELLSCHAFT   2017   49814000 |
2nd Company Example
Code:
      | ID         Company~e   Year      Sales |
      |----------------------------------------|
 116. |       23   ARTNET AG   2008   12218502 |
 117. |       23   ARTNET AG   2010   13672581 |
 118. |       23   ARTNET AG   2011   13340666 |
 119. |       23   ARTNET AG   2012   13487549 |
 120. |       23   ARTNET AG   2013   12968457 |
      |----------------------------------------|
 121. |       23   ARTNET AG   2014   13906644 |
 122. |       23   ARTNET AG   2017   18426024 |
I want the final dataset to include data for the first company (BETA) from the Year 2012 onwards since my criteria for minimum observations is five years. So far I managed to include all companies having at least five years of data, but not five consecutive years of data. So ideally, I want to include all observations of companies having at least five years of data without any gaps in years.
For the second company (ARTNET), I want the final dataset to include the data from 2010 to 2014 (five years of data), without the years before and after the gaps.

As of now I really don't know what to do. The only "solution" I currently have is to drop all companies with at least one gap. This however would exclude viable data which could be used if I had the solution described above.

I would really appreciate your help! Thanks a lot !

Greetings,
George