In a panel database of companies (bisnode), the revenue information is not always for the full year...sometimes it's quarterly, for example...

So I want to collapse rows such that rows that belong to the same company for the same year are merged. Not just that, I want most columns to average out, but I 2 columns to aggregate (sum).

Can I even run collapse such that it runs differently (average v sum) on different columns?