Hi everyone,
I want to generate a dichotomous random variable with the manifestations 1 or 2.
I only find runiform (a,b), but these Stata command gives me numbers between 1 and 2. I only want 1 OR 2.
Given: Variable with 1 to 5 manifestations. And the middle categorie (3) schould dedicated randomly to categorie 1 or 2.
gen Var =.
replace Var = 1 if Var2==1 // Agree
replace Var = 1 if Var2==2
replace Var = (?random variable?) if Var2==3 //Middle
replace Var = 2 if Var2==4 // Disagree
replace Var = 2 if Var2==5
Thank you for helping!
I want to generate a dichotomous random variable with the manifestations 1 or 2.
I only find runiform (a,b), but these Stata command gives me numbers between 1 and 2. I only want 1 OR 2.
Given: Variable with 1 to 5 manifestations. And the middle categorie (3) schould dedicated randomly to categorie 1 or 2.
gen Var =.
replace Var = 1 if Var2==1 // Agree
replace Var = 1 if Var2==2
replace Var = (?random variable?) if Var2==3 //Middle
replace Var = 2 if Var2==4 // Disagree
replace Var = 2 if Var2==5
Thank you for helping!
Comment