Reading the documentation can actually help. For instance from the online help for CATX:
Length of Returned Variable
In a DATA step, if the CATX function returns a value to a variable that has not previously been assigned a length, then that variable is given a length of 200 bytes. If the concatenation operator (||) returns a value to a variable that has not previously been assigned a length, then that variable is given a length that is the sum of the lengths of the values that are being concatenated.
So this paragraph shows why you may get different lengths with
y = catx(',', var1, var2);
and
y = var1||','||var2;
when y has not had a length assigned.
... View more