HI.. For the above query,I have a slight modification in the requirement in case of ties. Sample dataset: Cust_ID,MCG_1,MCG_2,MCG_3,MCG_4,MCG_5,MCG_6,MCG_7,MCG_8,MCG_9,MCG_10,MCG_11, Sp_1, Sp_2, Sp_3, Sp_4, Sp_5, Sp_6, Sp_7, Sp_8, Sp_9, Sp_10, Sp_11, 3478,2.5,2.5,2.5,9.5,9.5,8,.,2.5,5.5,7,5.5,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,11000, 3479,1.5,3.5,3.5,8.5,8.5,10,11,1.5,6,6,6,15000,14000,12500,11000,9000,8000,7500,15000,6000,5000,4000 The 11 attributes MCG_1 to MCG_11 are row wise ranks based on customer RFM scores in 11 merchant category groups(Shopping/Restaurants etc) and sp_1 to sp_11 their respective spends($) The codes shared by Tom & Arthur helped me create 11 new variables which gave me variable names based on their ranks;and both the variable names in case of ties. In case of ties,instead of tied variable names separted by '/ ' I now want the variable name of the Max value of corresponding tied spends. Earlier outcome was: Cust_ID rank1 rank2 rank3 rank4 rank5 rank6 rank7 rank8 rank9 rank10 rank11 3478 MCG_1/MCG_2/MCG_3/MCG_8 MCG_9/MCG_11 MCG_10 MCG_6 MCG_4/MCG_5 3479 MCG_1/MCG_8 MCG_2/MCG_3 MCG_9/MCG_10/MCG_11 MCG_4/MCG_5 MCG_6 MCG_7 Required outcome: Cust_ID rank1 rank2 rank3 rank4 rank5 rank6 rank7 rank8 rank9 rank10 rank11 3478 sp_8 sp_3 sp_2 sp_1 sp_11 sp_9 MCG_10 MCG_6 sp_5 sp_4 3479 sp_1 sp_8 sp_2 sp_3 sp_9 sp_10 sp_11 sp_4 sp_5 MCG_6 MCG_7 In 2nd record,MCG(1 & 😎 as well as Sp variable is tied for rank 1.Either of the variable name sp_1 or sp_8 will be acceptable in rank1 & rank2 values. Can this be done in SAS?
... View more