The maximum number of characters allowed in a calculated item is 8,191 in a SAS® Visual Analytics report


The maximum character limit for a calculated item created in a SAS Visual Analytics report is based on the character set encoding. For SAS® Viya®, UTF-8 is often used to store the data. The maximum length of a string in SAS® Cloud Analytic Services is 32,767 bytes. With UTF-8, one character can take up to 4 bytes of storage. As a result, when you calculate the number of characters that are available for the string, the calculation is 32767 / 4 = 8191 characters. Also, if data items are combined, then the combined size of the resulting data item must be less than or equal to 32,767 bytes.

For example, the following lengths (in bytes) are specified:

Length DataItem1 $30000;

Length DataItem2 $2000;

Length DataItem3 $2000;
 
When creating a calculated item, all three data items cannot be concatenated together because the combined byte total would be 34,000, which is over the 32,767 byte limit.

In this scenario, an error message similar to the following is displayed: 

An error occurred. com.sas.cas.CASException: The user-defined programming statements could not be parsed... The parameter value is not within the required range of 1 and 32767
 
Visual Analytics CAS exception error parameter value not within required range