Hi statalist community,
I need to generate two variables for my research.
1st variable needed
ID_max=x_id if x is greater than y and z
ID_max=y_id if y is greater than x and z
ID_max=z_id if z is greater than x and y
2nd variable needed
ID_min=x_id if x is less than y and z
ID_min=y_id if y is less than x and z
ID_min=z_id if z is less than x and y
may anyone please help?
regards,
ajay
I need to generate two variables for my research.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(x_id y_id z_id) int(x y z) 1 2 3 130 120 100 1 2 3 100 120 120 1 2 3 300 350 350 1 2 3 300 300 310 1 2 3 360 360 90 1 2 3 250 60 30 1 2 3 250 15 30 1 2 3 35 25 35 1 2 3 300 270 100 1 2 3 41 225 225 1 2 3 100 70 140 1 2 3 300 300 330 1 2 3 300 60 30 1 2 3 330 300 350 1 2 3 345 200 300 1 2 3 200 200 300 1 2 3 300 80 300 1 2 3 100 300 100 1 2 3 20 280 230 1 2 3 340 200 50 1 2 3 60 180 180 1 2 3 145 130 195 end
ID_max=x_id if x is greater than y and z
ID_max=y_id if y is greater than x and z
ID_max=z_id if z is greater than x and y
2nd variable needed
ID_min=x_id if x is less than y and z
ID_min=y_id if y is less than x and z
ID_min=z_id if z is less than x and y
may anyone please help?
regards,
ajay
Comment