-
SAS Strings
1. Concatenation functions
/*****************************************************************************/
/* Title: Concatenation functions in SAS 9.0 */
/* */
/* Goal : Illustrate the new CAT functions. */
/* */
/* Note : CAT - concatenates character strings without removing leading or trailing blanks */
/* CATS - concatenates character strings and removes leading and trailing blanks */
/* CATT - concatenates character strings and removes trailing blanks */
/* CATX - concatenates character strings, removes leading and trailing blanks, and inserts separators */
/* */
/*****************************************************************************/
data test;
input (x1-x4) ($);
x5=' 5';
length new1 $40 new2-new4 $10 ;
new1=cat(of x1-x5);
new2=cats(of x1-x5);
new3=catt(x1,x2,x3,x4,x5);
new4=catx(',', of x1-x5);
keep new:;
datalines;
1 2 3 4
5 6 . 8
;
proc print;
run;
/* RESULTS */
Obs new1 new2 new3 new4
1 1 2 3 4 5 12345 1234 5 1,2,3,4,5
2 5 6 8 5 5685 568 5 5,6,8,5
