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.