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.
Related Posts with Drop before calculating a mean
Declaring class as a function into a class. Why ?Dear statalisters, I just read this part of the manual. Code: class U { real matrix M private real…
Error in strdupDear All, I am trying to understand the exact reason the string duplication fails sometimes. The do…
panel xtglsHi, i've got a problem with the estimation i'm doing. i have a panel with n=8 and T=27. i have teste…
Meta analysis Stata 16I have 2 questions: 1. How to retain "zero" and "1" proportion in meta-analysis of proportion studie…
Fixed Effects Residuals and Endogeneity TestHi there, I estimate a model using FE and also FE2SLS and I would like to compare the FE and FE2SLS …
Subscribe to:
Post Comments (Atom)
0 Response to Drop before calculating a mean
Post a Comment