Hey guys ! If I have a dummy with 1 and zero wether a trade is a buy or sell and want to find out what the average return per fund of the buys is (so one value over all funds), do have to drop the sells before or after I calculate then mean of every individual fund? (It is a buy if the dummy buy has a value of 1)
So is it:

drop if buy!=1
bysort FundID: egen average_per_fund = mean(fund_mothly_return)
egen tagvar = tag(FundID)
egen mean_fund_return_alldates = mean(average_per_fund) if tagvar

or

bysort FundID: egen average_per_fund = mean(fund_mothly_return)
drop if buy !=1
egen tagvar = tag(FundID)
egen mean_fund_return_alldates = mean(average_per_fund) if tagvar

Thanks.