HI I am trying to use the scan function . what i am trying to do is to if address 1 contains the apt number flip and change address 1 and address 2. if it doesnt keep the same values. But the code for some reason is assigning only the first character to the variable a1. Example if address1= 123 main st a1= 1. but if i flip the if and else statements it works. Example if address1= 123 main st a1= 123 main st. I do not understand why is this happening. The same logic works on a diff data set. The current address data is being imported from a excel file. data_1;
set data _2;
if SCAN(address1,1,' ') in
('APT',) then do;
a1 = Address2;
a2 = Address1;
switch=1;
end;
else if SCAN(address1,1,' ') not in
('APT',) then do;
a1 = Address1;
a2 = Address2;
switch=1;
end;
run;
... View more