BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
J111
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
J111
Quartz | Level 8

This works !


data want;
set matrix ;
length want $32767;
want =catx(", ", of col:) ;
run;

View solution in original post

2 REPLIES 2
J111
Quartz | Level 8

This works !


data want;
set matrix ;
length want $32767;
want =catx(", ", of col:) ;
run;

ballardw
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 645 views
  • 0 likes
  • 2 in conversation