BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am getting a warning while using simple string concatenation function CAT in the code line

%let outputFileNameCSV = CAT(outputFolderName,datasetName);

The warning says -
WARNING: In a call to the CAT function, the buffer allocated for the result was not long enough to contain the concatenation of all the arguments. The correct result would contain 527 characters, but the actual result may either be truncated to 200 character(s) or be completely blank, depending on the calling environment. The following note indicates the left-most argument that caused truncation.


I checked the documentation and found this...

---------------------------------------------------------------------------------------------------------
Length of Returned Variable: Special Cases
The CAT function returns a value to a variable, or returns a value in a temporary buffer. The value that is returned from the CAT function has the following length:

up to 200 characters in WHERE clauses and in PROC SQL

up to 32767 characters in the DATA step except in WHERE clauses

up to 65534 characters when CAT is called from the macro processor

If CAT returns a value in a temporary buffer, the length of the buffer depends on the calling environment, and the value in the buffer can be truncated after CAT finishes processing. In this case, SAS does not write a message about the truncation to the log.

--------------------------------------------------------------------------------------------------------
The sentence "the length of the buffer depends on the calling environment" tells me that I can do something about the warning I'm getting. But I do not understand which option in SAS environment I need to tweak and how..

Can someone please point out how to do that?

Thanks,
Neel
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You have coded an incorrect usage of the CAT function, where to use it with the macro language you must code it with the %SYSFUNC macro function call. Consider also there is a limit to the max size of a SAS macro variable. And, when using the function in a DATA step, you really should consider declaring a LENGTH statement to ensure desired results with the assigned SAS dataset variable.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Thanks Scott.

Will try with LENGTH statement.
deleted_user
Not applicable
Yes Scott, changing the length to little higher value worked.

Thanks!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 6461 views
  • 0 likes
  • 2 in conversation