Hi all,
I have a code that was working fine before migrating to sas 9.4. After migration the code is giving error regarding the macro size.
PROC SQL ;
SELECT
cats("'",_fk,"'")
INTO :string1
SEPERATED BY ","
FROM
referral_lst;
QUIT;
ERROR: The length of the value of the macro variable STRING1 (65540) exceeds the maximum length (65534). The value has been
truncated to 65534 characters.
I managed to sort this issue by:
proc sort data=referral_lst; by _fk ; run;
data _null_;
length mvarlist value_list $32000 mvar $32;
retain mvarlist;
varnum+1;
do until(length(value_list)>30000 or eof);
set referral_lst end=eof;
by _fk ;
if first._fk then value_list=cats(',',value_list,quote(trim(_fk),"'"));
end;
mvar=cats('_fk_list',varnum);
call symputx(mvar,value_list);
mvarlist=cats(',',mvarlist,'&'||mvar);
if eof then call symputx('_fk_list',mvarlist);
run;
now I'm using this macro in a different part of the code:
select distinct
from (
SELECT SUB_KEY, IDENTIFIER, VERSION
FROM _SUBMISSIONS
WHERE src_end_ts = DATE'9999-12-31' and identifier in (&_fk_list.)
) SUB
Now I receive this error:
ERROR: The text expression length (66815) exceeds maximum length (65534). The text expression has been truncated to 65534
characters.
Appreciate your help!