Hi, everyone, I am a relatively new user of stata. Well, I'm trying to make a 'sdtest' for two groups for a variable. I'm using a survey which has 24 regions. These regions have a id or a number to identify them. I built a variable called "state_confidence" that is an indicator of confidence in institutions. I am analyzing this indicator across regions and I want to make a sdtest for just those two regions.
Thus, I just want to compare the variance between those individuals that belong to those regions.
* 'depto' is a numeric variable which put a number in a specific order between 1 to 24 for each of these regions. Then, I built two dummies for just two of them and so compare using sdtest.
gen conf_puno=0
replace conf_puno=1 if depto==21
label var conf_puno "Individuo from region 21"
gen conf_lima=0
replace conf_lima=1 if depto==15
label var conf_lima "Individuo from region 15"
*Variance test
sdtest stateconf if conf_puno==1 & conf_lima==1
The problem is that Stata notify that an error which says "by() option required"
How I fix this problem??
Thank you for your help. Seriously, I tried to solve this by myself, but I consider that this forum would have new ideas to do that.
Thanks again.
Thus, I just want to compare the variance between those individuals that belong to those regions.
* 'depto' is a numeric variable which put a number in a specific order between 1 to 24 for each of these regions. Then, I built two dummies for just two of them and so compare using sdtest.
gen conf_puno=0
replace conf_puno=1 if depto==21
label var conf_puno "Individuo from region 21"
gen conf_lima=0
replace conf_lima=1 if depto==15
label var conf_lima "Individuo from region 15"
*Variance test
sdtest stateconf if conf_puno==1 & conf_lima==1
The problem is that Stata notify that an error which says "by() option required"
How I fix this problem??
Thank you for your help. Seriously, I tried to solve this by myself, but I consider that this forum would have new ideas to do that.
Thanks again.
Comment