I want to create calculated column 'sec'- as per the below file format. I have columns Prim, Oth1 to Oth6 in my actual input file.
Prim- is the highest value among columns Oth1 to Oth 6.
Sec - is the second highest value among columns Oth1 to Oth6. But If there are columns with same highest values, then prim and sec are the same.
Eg : In the case of ser# 00191J, Prim is 2 sec is 1.
For 546720 Prim is 4 sec is also 4. Since Oth1 is having value 4 and Oth2 is also having value 4.
For 04864F Prim is 3 sec is 0
Is there any way I create this sec column ?
Code: Select all
Ser # Prim Oth1 Oth2 Oth3 Oth4 Oth5 Oth6 Sec
00191J 2 2 1 0 1 0 0 1
546720 4 4 4 3 0 0 0 4
04864F 3 0 3 0 0 0 0 0
2121AC 3 3 3 2 2 0 0 2
04974N 0 0 0 0 0 0 0 0
Regards
Sree