Hi @shubham1
CATX ignores arguments with missing values. It takes a list of variables and put a delimiter between <something> and <something>. So it never returns a string with a leading delimiter, a trailing delimiter or 2 or more consecutive delimiters. If you want delimiters between all elements, missing or not, I don't think there is a simple function. But it can be done with an array, see the following code:
data new;
a=' ';
b = 'abc';
c=' ';
d=' ';
e = 'efg';
f=' ';
run;
* No delimiters between missing;
data _null;
set new;
zz=catx(',',a,b,c,d,e,f);
put zz;
run;
/* Result:
abc,efg
*/
* Delimiters between all variables;
data _null_;
set new;
array elements[*] _character_;
length zz $20.;
zz = elements{1};
do i = 2 to dim(elements);
zz = trim(zz) || ',' || trim(elements{i});
end;
put zz=;
run;
/* Result:
,abc,,,efg,
*/
... View more