Hello everyone,

I have a panel data set with data on the investments of German firms into other countries. The data are mainly about the target investment enterprises, but it also has some data on the German investor company and sometimes also on the corporote group of the German investor in case the German investor is part of a corporate group. So it has the following structure:
year country investor investment corporate group of investor equity of investment sales of investor sales of corporate group
2017 country1 inv_ID01 target_ID01 group_ID01 x x x
2017 country1 inv_ID01 target_ID02 group_ID01 x x x
2017 country2 inv_ID02 target_ID03 . x x .
2017 country2 inv_ID03 target_ID04 group_ID02 x x x
2018 country1 inv_ID01 target_ID01 group_ID01 x x x
... ... ... ... ... ... ... ...
I want to collapse the data in a way that I only see the aggregated equity that a German investor has in a given year and country. I already know that I can do that by using

Code:
collapse (sum) equity, by(year country investor)
This gives me the following new table:
year country investor equity of investment
2017 country1 inv_ID01 x
2017 country2 inv_ID02 x
2017 country2 inv_ID03 x
2018 country1 inv_ID01 x
... ... ... ...
But now comes the problem I can't solve. Rather than looking at the whole sample, I would like to split this above collapsed sample into three different size categories. The category criteria should be the sales of either the German investor or of the corporate group that the German investor belongs to in case that it does belong to a corporate group.

The idea behind it is the question whether the results of my main analysis change depending on the size of the investor. However, only looking at the investor sales will not give a true picture of the size, because sometimes these investors are only holdings with 0 sales, so it is necessary to look at the whole corporate group. I tried many approaches by now but couldn't figure out a solution.

Does anyone have an idea how to solve this problem?

Best regards,
Anton