Dear all,
I am new to stata and I can't figure out how to create a loop for the following code. This problem seems to be recurring in various forms in my descriptive statistics, so any help is greatly appreciated.
var1 is discrete (5 values)
var2 is continuous
var3 is discrete (3 values)
My code:
bysort var1: xtsum var2 if var3==1
bysort var1: xtsum var2 if var3==2
bysort var1: xtsum var2 if var3==3
I am now looking for loops to make this code more efficient.
Sorry for this basic question!
Cheers,
Katharina
I am new to stata and I can't figure out how to create a loop for the following code. This problem seems to be recurring in various forms in my descriptive statistics, so any help is greatly appreciated.
var1 is discrete (5 values)
var2 is continuous
var3 is discrete (3 values)
My code:
bysort var1: xtsum var2 if var3==1
bysort var1: xtsum var2 if var3==2
bysort var1: xtsum var2 if var3==3
I am now looking for loops to make this code more efficient.
Sorry for this basic question!
Cheers,
Katharina
Comment