Dear Statalist,
I have 768 variables for right eye and the corresponding same 768 variables for left eye. I want to create a new variable based on the best result comparing right and left eye.
For example, I have: 1OD, 1OS, 2OD, 2OS, 3OD, 3OS etc... 768OD, 768OS.
I usually do this when I have just one variable:
generate best1 = 1OD if 1OD > 1OS
replace best1 = 1OS if best1==.
However I have do to this for 768 variables. The name of the variables are exactly the same, but there is OD or OS in the beginning of these 768 variables.
Do you have any suggestions?
Thank you so much!
Carolina
I have 768 variables for right eye and the corresponding same 768 variables for left eye. I want to create a new variable based on the best result comparing right and left eye.
For example, I have: 1OD, 1OS, 2OD, 2OS, 3OD, 3OS etc... 768OD, 768OS.
I usually do this when I have just one variable:
generate best1 = 1OD if 1OD > 1OS
replace best1 = 1OS if best1==.
However I have do to this for 768 variables. The name of the variables are exactly the same, but there is OD or OS in the beginning of these 768 variables.
Do you have any suggestions?
Thank you so much!
Carolina
Comment