This issue drives me crazy. In SAS, when I want to concat a string, the variable which will be assigned to the result cannot be used in the input.
DATA test1;
LENGTH x $20;
x = "a";
x = x || "b";
RUN;
Result: x = "a";
DATA test2;
LENGTH x $20;
y = "a";
x = y || "b";
RUN;
Result: x = "ab";
DATA test3;
LENGTH x $20;
x = "a";
y = x;
x = y || "b";
RUN;
Result: x = "a";
The last one is so strange. x is not even involved in concat directly.
This does not make sense. Because 1) you can do other operations in this way, e.g. transtrn, substr. 2) SAS does not give any warning message.
Why?