Hi and thank you for the quick reply. The problem is to find the start position for the last chunk. The "A" and the "B" are also variable lenghts. They can be any number of characters. Also there is the possibility that A = B such that when I search for the position of the string with find I am not sure if I receive the first instance or the second one ... What I don't understand if why the do code doesn't work ... Considering my previous example with A_B_1_2_3, the first value should be A, the second should be B and then I need to have 1.2.3 ... However the code below returns "...1" What do I do wrong? data work.sums_processed (compress=yes);
set work.sums_prev;
First_value = scan(_NAME_,1,'_');
Second_value = scan(_NAME_,2,'_');
no_words = countw(_NAME_,'_');
category = scan(_NAME_,3,'_');
do i = 4 to (countw(_NAME_,'_'));
category = catx(category,'.',scan(_NAME_,i,'_'));
end;
run; Thank you
... View more