Hi Costasg, Sincere apology, please find the updated code below :- data test; set tmp1.air; run; /*****filling country value*****/ proc sort data=test out=test_sorted; by mgrno descending country; run; data step1(drop=country rename=(country_new=country)); set test_sorted; by mgrno ; retain country_new; if first.mgrno then country_new=country; run; /****filling Exchange Code, Stock Class Code, Stock Class Description and Industry Code***/ proc sort data=step1 out=step1_sorted; by ticker descending EXCHCD descending STKCD descending STKCDESC descending INDCODE; run; data step2(drop=EXCHCD STKCD STKCDESC INDCODE rename=(exchcd_new=EXCHCD STKCD_new=STKCD STKCDESC_new=STKCDESC INDCODE_new=INDCODE)); set step1_sorted; by ticker; retain exchcd_new STKCD_new STKCDESC_new INDCODE_new; if first.ticker then do; exchcd_new=EXCHCD; STKCD_new=STKCD; STKCDESC_new=STKCDESC; INDCODE_new=INDCODE; end; run; Please use this code and hope it will work Thanks, Ankit
... View more