Hey listers, I want to do a t-test for 4 variables (buy1,sell1, buy2, sell2) (they all match certain conditions hence I gave them the value 1 if they do) (for each t-test only comparing 2 of them). So I generated 2 groups
gen group = 1 if buy1 == 1
replace group = 2 if sell1 == 1
ttest var, by(group)
But how do I do compare everytime 2 of the 4 groups? tried it with command foreach, but I am not sure how to do that. (I want to do that for a few more variables.)
I hope there is a solution.
Related Posts with T-Test with foreach (for 4 Variables)
Problem with MergingHi, I am trying to merge two datasets which look as follows: Master Data: Year State Constituen…
Good sources for learning about Stata macros?Do y'all have recommendations on the best place to point students who have rudimentary Stata familia…
From yearly to quarterly dataHello to all! I am new to this Forum, please apologies if I am not using it right. I have a question…
Create value-weighted decile portfoliosI want to build Dezil portfolios based on the last observed values of the respective calendar year f…
Dropping dupicatesHi Statlist, I have the following dataset: Code: * Example generated by -dataex-. To install: ss…
Subscribe to:
Post Comments (Atom)
0 Response to T-Test with foreach (for 4 Variables)
Post a Comment