When you execute PROC COMPARE using DOSUBL and the log and output are written to a file using PROC PRINTTO, the output file is empty. When you execute DATA step PUT statements using DOSUBL and the log and output are written to a file using PROC PRINTTO, the output file is empty, and the log file does not reflect the PUT statements.
The following code replicates the problem:
proc printto print= "proc_compare.lst" log="proc_compare.log" new;
run;
data _null_;
exec = 'proc compare base=sashelp.class comp=sashelp.class listall;run;';
rc=dosubl(exec);
run;
proc printto;
run;
proc printto print= "data_step.lst" log="data_step.log" new;
run;
data _null_;
exec = 'data _null_; set sashelp.class; put (_n_ _all_) (=);file print;put (_n_ _all_) (=);run;';
rc=dosubl(exec);
run;
proc printto;
run;
CALL EXECUTE might write all files as expected, but if the code is part of a macro that is invoked with CALL EXECUTE, it might not work as expected. Using standalone PROC COMPARE or DATA step code outside of CALL EXECUTE or DOSUBL within the PROC PRINTTO blocks also writes the files as expected.