Hello,
We would like to use CATX for concatenation of 30 words, each word has about 32 characters.
The input SAS file matrix has col1, col2 until col30 variables. The log mentions an issue with buffersize.
code:
options bufsize=MAX ;
data _null_ ;
set matrix ;
want = catx(", ", of col:) ;
run ;
log:
WARNING: In a call to the CATX function, the buffer allocated for the result was not long enough to contain the concatenation of
all the arguments.
available;
We were able to create the concatination with simple code
want = col1||col2|| until ||col30
However the automation is important and the number of columns may change in the future from 30 to 35.
Appreciate your advice.
This works !
data want;
set matrix ;
length want $32767;
want =catx(", ", of col:) ;
run;
This works !
data want;
set matrix ;
length want $32767;
want =catx(", ", of col:) ;
run;
30 variables of length 32: 30*32 =960 characters plus 29 commas=989 characters. Your length is a tad excessive.
The message you received is because by default the CATX function will use 200 as the default length if the length of the target variable is not set. So you tried to cram about 989 into 200 spaces and get the message.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.