Hello,
I have a data base composed of three numeric variables : A ; B ; C
I am trying to generate one variable (let's say X) containing the closest value to 0 among the three values provided by the variables A, B and C.
For exemple, among the three values (348 ; -6 ; -361), I would like the X to choose -6. Among the values (383 ; 29 ; -326), I would like to X to choose 29.
N.B. : I am using the Stata 14.0
Thank you very much.
I have a data base composed of three numeric variables : A ; B ; C
Code:
clear input float(A B C) 348 -6 -361 436 82 -273 403 49 -306 376 22 -333 390 36 -319 390 36 -319 397 43 -312 383 29 -326 364 10 -345 375 21 -334 384 30 -325 403 49 -306 422 68 -287 355 1 -354 413 59 -296 347 -7 -362 418 64 -291 425 71 -284 end
For exemple, among the three values (348 ; -6 ; -361), I would like the X to choose -6. Among the values (383 ; 29 ; -326), I would like to X to choose 29.
N.B. : I am using the Stata 14.0
Thank you very much.
Comment