Try this simplified example:
options ls=max mprint=1;
filename record temp;
proc scaproc;
record record expandmacros opentimes;
run;
data x; x=1; run;
%global classvars;
%let classvars=NAME SEX;
%if 0 %then %do;
%let classvars=%m_expand_varlist(data=sashelp.classfit,var=_CHARACTER_,out=expand);
%end;
%if 1 %then %do;
%let classvars=%sysfunc(dosubl(%nrstr(proc summary data=x;output out=z;run;)));
%end;
%put NOTE: &=classvars;
proc summary data=x ;
output out=y;
run;
proc scaproc;
write;
run;
data _null_;
infile record;
input;
list;
run;
Using %SYSFUNC(DOSUBL()) truncates the collection.
21 /* JOBSPLIT: STEP SOURCE FOLLOWS */ 35
22 0
23 data x; x=1; run; 17
24 0
25 %global classvars; 18
26 %let classvars=NAME SEX; 24
27 %if 0 %then %do; 16
28 %let classvars=%m_expand_varlist(data=sashelp.classfit,var=_CHARACTER_,out=expand); 83
29 %end; 5
30 %if 1 %then %do; 16
31 %let classvars=%sysfunc(dosubl(%nrstr(proc summary data=x;output out=z;run;))); 79
32 0
33 /* JOBSPLIT: JOBENDTIME 03JUN2026:16:06:47.17 */ 48
34 /* JOBSPLIT: END */ 19
But calling your macro does not truncate, instead it causes it to write gibberish.
58 /* JOBSPLIT: STEP SOURCE FOLLOWS */ 35
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
59 CHAR ................0 17
ZONE 00000000000000003
NUMR 00000000000000000
60 0
...
77 /* JOBSPLIT: STEP SOURCE FOLLOWS */ 35
78 CHAR ...
[email protected]�w�D...Pevo....�.�2............��o�D...u.......��o�D...........��o�D...��o�D.......
ZONE 0002100400060007F7A470056760000E1A3000000000000CE6B4700700000008E6B470010000000AD6B4700AD6B470010002
NUMR 000000000001000007F4F00056F0000DF1200000000000007F04F005000000001F04F00100000000FF04F000FF04F0020000
101 ...`...Q...p�w�D...Pevo....�.�2............data x; x=1; 155
ZONE 100600050007F7A470056760000E1A3000000000000667627327333
NUMR 00000001000007F4F00056F0000DF12000000000000414108B08D1B
79 0
80 /* JOBSPLIT: TASKSTARTTIME 03JUN2026:16:12:39.10 */ 51
...
... View more