data have;
input var $50.;
cards;
1545253657356_EI_1_15_CUP_A
1545253657356_EI_1_15_MUG_A
1545265347356_EI_1_15_BOWL_A
1545T432657356_EI_1_15_CUP_B
15452657356_EI_1_15_MUG_B
1545265237356_EI_1_15_BOWL_B
;
data want;
set have;
key=substr(var,findc(var,,'db')+2);
run;
it works perfect. thank you so much Ksharp.. What does the modifier 'db' mean? findc(var,,'db')+2 returns the position of the first letter of the last two words (my "key word"). How this is achieved in such a simple function?! it's like magic!
Ready to join fellow brilliant minds for the SAS Hackathon?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.