1. The code you supplied is invalid.
2. You logic can be simplified to:
if ADDRESS1 =: 'APT ' then do;
A1 = ADDRESS2;
A2 = ADDRESS1;
SWITCH=1;
end;
else do;
A1 = ADDRESS1;
A2 = ADDRESS2;
SWITCH=1;
end;
provided ADDRESS1 is left-aligned.
3. Note that variable SWITCH is always set to 1.
... View more