This code doesn't work if there is a consecutive occurrence of same value in the list. like x a a b b a b a b Simple case statement in proc sql query will fix it. proc sql;
create table want as
select case x when 'a' then 'b'
when 'b' then 'a'
end as x
from a ;
... View more