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
how to calculate N2/N1 by citycode_show to calculate the "income_mean"=second one /first one, by citycode_s!
for example,citycode_s 1100…
Connecting Labels from X AxisHello,
I keep getting an error with the code below, although I have used a similar code in the past…
Ramsey RESET testHi,
Is it possible to use the Ramsey RESET test with only one regressor?:
Stata omits the varia…
Ramsey RESET testHi,
Is it possible to use the Ramsey RESET test with only one regressor?:
Stata omits the varia…
Predict,xbHi all,
I am trying to run the following command to predict yhat and I am only getting missing value…
Subscribe to:
Post Comments (Atom)
0 Response to Drop before calculating a mean
Post a Comment