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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

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