@tinayong wrote: output of the program 123 t21 at1 at1 ea2 ate b=substr(trt,length(trt)-2); length of the variabke is 8 and 8-2 =6, so for the first observation from the sixth position we get the values using substr function but from the second observation onwards the obs values decreasing but still substr function extracting last 3 values So am missing some logic here, may be am not thinking correct way
Perhaps you phrased your question incorrectly. If you are wanting the numbers at the end and not the "last 3 values" then @RW9 has your solution with compress function
... View more