@vikram_e wrote: Hi There, I am having set of variables (trt01 - trt07) having character values , i need to find maximum non missing treatment from 7 treatments group.i need to use that last 2 digit number in a macro variable. trt01 trt02 trt03 trt04 1 abc def -----------> trt03 2 abc -----------> trt01 3 abc def ght dsa ------------> trt04 any one help me please. Can you explain what should be stored in the macro-variable after all obs have been processed? To find the last treatment use an array and a loop with decreasing index variable.Something like (untested code😞 array t trt01-trt04;
do i = dim(t) to 1 by -1;
if not missing(t[i]) then do;
max = vname(t[i]);
leave;
end;
end;
... View more