BookmarkSubscribeRSS Feed
ari
Quartz | Level 8 ari
Quartz | Level 8

Dear Experts,

 

I encountered this error from running this code:

 

ERROR: The text expression length (65572) exceeds maximum length (65534). The text expression has
been truncated to 65534 characters.

 

proc sql;
select catx("=", NAME, quote(trim(dscr)))
into :label_list separated by " "
from test;
quit;

 

Is there a way to solve this error?

 

Please let me know.

Many thanks in advance.

 

 

3 REPLIES 3
gamotte
Rhodochrosite | Level 12

Hello,

 

What are you creating this macrovariables list for ?

Macro language is not meant to be used to manipulate data.

So the solution would be not to create this list of macrovariables and

use bases SAS language to achieve your goal.

Kurt_Bremser
Super User

@ari wrote:

 

Is there a way to solve this error?

 

 


Yes. Stop abusing macro variables for things they are not meant for.

DATA belongs in DATASETS.

 

You can always use your above select as a sub-select in SQL, load a hash object in a data step from it, or create a format. Or do a join, which will scale up until you run out of disk storage.

s_lassen
Meteorite | Level 14

Sounds like you are trying to generate a list of variable labels, to use in another program, e.g.:

Data want;
  set have;
  label &label_list;
run;

I would consider writing the code to a temporary file instead:

filename tempsas temp;
Data _null_;
  file tempsas;
  put 'label';
  do _N_=1 to nobs;
    set test nobs=nobs;
    dscr=quote(trim(dscr),"'");
    put name '=' dscr;
    end;
  put ';';
end;

data want;
  set have;
  %include tempsas;
run;
  
  

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 3114 views
  • 3 likes
  • 4 in conversation