I have a SAS program (let's call it program1) that calls another SAS program to execute using %include (let's call it program2). If I run program2, on its own, the program executes perfectly fine. However, if I run program1, program2 fails when called by %include: SYMBOLGEN: Macro variable PROD_GRP resolves to mttt
"mttt"
SYMBOLGEN: Macro variable PROD_GRP resolves to mttt
MPRINT(SOS_MACH): data serno_ mttt;
SYMBOLGEN: Macro variable PROD_GRP resolves to mttt
MPRINT(SOS_MACH): set serials2_ mttt;
ERROR: File WORK.SERIALS2_.DATA does not exist.
MPRINT(SOS_MACH): eqp_id = trim(ser_no) || "CAT";
MPRINT(SOS_MACH): run; We can see from symbolgen, there is no leading white space, but from mprint, SAS has inserted a leading white space. Here is the code snippet that it is erroring on. data prod;
format names $5.;
input names;
datalines;
mttt
pipe
ttl
;
run;
data _null_;
set prod nobs = n;
call symputx ('cnt', n);
run;
%macro sos_mach;
%local i prod_grp;
%do i = 1 %to &cnt;
data _null_;
set prod (obs = &i firstobs = &i);
call symputx ('prod_grp', names);
run;
%put "&prod_grp";
data serno_&prod_grp;
set serials2_&prod_grp;
eqp_id = trim(ser_no) || "CAT";
run;
%end;
%mend sos_mach; I am using symputx which would remove any leading or trailing white spaces as well. How can I correct this problem that only occurs when program2 is called in program1 with a %include?
... View more