Hi all,
I have data set that look like this:
Is there a command that creates a new variable x which contains a randomly chosen non-missing value of the variables x1 to x5. (And if all of x1 to x5 are missing (think D), x should also be missing.)
Is there a simple solution to this problem, think -egen x = rowrandom(x1 x2 x3 x4 x5)-?
Thanks
Go
I have data set that look like this:
Code:
input str1 id x1 x2 x3 x4 x5 "A" 1 . 2 . 2 "B" 5 1 3 5 5 "C" 2 3 2 . 1 "D" . . . . . "E" 6 6 1 4 1 end
Is there a simple solution to this problem, think -egen x = rowrandom(x1 x2 x3 x4 x5)-?
Thanks
Go
Comment