Professional Documents
Culture Documents
May 2, 2002
X1||X2||X3||X4
CATT(OF X1-X4)
TRIM(X1)||TRIM(X2)||TRIM(X3)||TRIM(X4)
CATS(OF X1-X4)
TRIM(LEFT(X1))||TRIM(LEFT(X2))||TRIM(LEFT(X3))||
TRIM(LEFT(X4))
X1=TRIM(X1)||TRIM(X2)||TRIM(X3)||TRIM(X4);
X1=TRIM(LEFT(X1))||TRIM(LEFT(X2))||
TRIM(LEFT(X3))||TRIM(LEFT(X4));
"X+Z".
Examples:
In this DATA step, the CALL CATS routine prints messages because the
variable A has a length of only 4, which is not long enough to hold
the concatentation of two strings with a nonblank length of 3:
data _null_;
length a b $4;
a = 'abc';
b = 'xyz';
call cats(a,b);
put a= b=;
run;
In this DATA step, truncation is done silently after the CATS function
finishes:
data _null_;
length a b $4;
a = 'abc';
b = 'xyz';
a = cats(a,b);
put a= b=;
run;
In this DATA step, truncation occurs inside the CATS function,
appropriate messages are issued, and the result is set to a blank
value:
data _null_;
length a b c $4;
a = 'abc';
b = 'xyz';
c = cats(a,b);
put a= b= c=;
run;
In this DATA step, truncation is done silently:
data _null_;
length a b c $4;
a = 'abc';
b = 'xyz';
c = trim(cats(a,b));
put a= b= c=;
run;