That %IF/%THEN/%ELSE is just being used to stuff some SAS code into a macro variable.
Is the problem that you want to stuff two SAS statements into the macro variable CONDITION when is TRIM is set to 0?
Just add a semi-colon between the two statements inside the %STR() macro function call.
%if &trim=0 %then %let condition =
%str(if myvars(i)< perct1(i) then myvars(i)=perct1(i)
;if myvars(i)> perct2(i) then myvars(i)=perct2(i)
)
;
%else %let condition =
%str(myvars(i)=min(perct2(i),max(perct1(i),myvars(i)))
)
;
... View more