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)
Bulk reordering the name of variable conditional on it's formatI am currently cleaning survey data that contains 1000+ variables many of which need to be renamed b…
Event study regression with multiple events for a certain firmHi Statalist forums, I am working on an event study where I am studying the cash dividend payouts o…
Multilevel SEMI have a question about SEM and would like to learn some solutions. Suppose I use three indicators …
Cannot get options to work on graph twowayI'm using the following code to produce a bar chart with confidence intervals. If I drop the options…
"Un-panelling" of a datasetHi, To tell stata you're dealing with a panel data set you use the command 'xtset'. I've saved the …
Subscribe to:
Post Comments (Atom)
0 Response to T-Test with foreach (for 4 Variables)
Post a Comment