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
estat classification - return matrixi am running a logit and then estat classification when i do Code: return list stata shows Code:…
How copy graphs to word? I see the button for "copy" the graph but could not paste it to word.I see the button for "copy" the graph but could not paste it to word since "paste" button in word is…
Copy over variable labels when standardizingI have a dataset with over 300 variables and 80000 observations. A bunch of the variables are on sca…
Bruteforcing regressionsFrom a set of about 300 variables, I've pared down to about 30 potential x variables. Assuming a lin…
Comparing a variable acorss many categoriesI want to test that a variable does not differ by group. I get how to do it between two groups but n…
Subscribe to:
Post Comments (Atom)
0 Response to Drop before calculating a mean
Post a Comment