Hi,
I am running a simulation where I generate a variable that takes on integer values 1-5 with equal probability using the command:
gen initial = int(1+(5*uniform()))
I then want to create a variable (secondary) that randomly selects one of the four numbers that is never one and is also not the value of the variable "initial"
(ex. if initial==2, secondary can take on values 3,4, 5 with equal probability). Would this be achieve with something like:
gen secondary= int(2+(4*uniform())) if true==1
replace secondary=int(3+(4*uniform())) if true==2, etc?
Thank you.
I am running a simulation where I generate a variable that takes on integer values 1-5 with equal probability using the command:
gen initial = int(1+(5*uniform()))
I then want to create a variable (secondary) that randomly selects one of the four numbers that is never one and is also not the value of the variable "initial"
(ex. if initial==2, secondary can take on values 3,4, 5 with equal probability). Would this be achieve with something like:
gen secondary= int(2+(4*uniform())) if true==1
replace secondary=int(3+(4*uniform())) if true==2, etc?
Thank you.
Comment