Why does the code below work (&ds
is 12345678910
), but when I change cats
to cat
, &ds
is just blank? I would expect changing cats
to cat
would mean &ds
is 1 2 3 4 5 6 7 8 9 10
.
data new;
length ds $500;
ds = "";
do i = 1 to 10;
ds = cats(ds, i, " ");
end;
call symputx('ds', ds);
run;
%put &ds;
The function cat()
will not trim the values so if you concatenate anything to DS
and try to store it back into DS
whatever you added is not stored because there is no room for it.
It appears you actually want the catx()
function.
ds = catx(' ',ds, i);