Hi, I found the submit-endsubmit method does not work in this case.
resetline;
ods html close;
ods graphics off;
ods listing;
proc printto log="Noname.txt";
run;
proc iml;
do IMLVariable=1 to 30;
submit IMLVariable;
%put IMLVariable=&IMLVariable;
endsubmit;
end;
quit;
proc printto;
run;
quit;
I thought the iterations would be recorded in Noname.txt, but in this case SAS displays the iterations using SAS Message Log instead.
Thanks in advance.
Your example works on SAS 9.4M5 (Windows) and creates the file Noname.txt in the current working directory.
1. What version of SAS are you running?
2. What operating system?
2. What interface to SAS are you using (DMS, EG, or SAS Studio)?
If you are running an old version of SAS, I might have a hunch. Run the following program. Do you get the same behavior or does it work as expected?
proc iml;
submit;
proc printto log="Noname.txt";
run;
endsubmit;
do IMLVariable=1 to 30;
submit IMLVariable;
%put IMLVariable=&IMLVariable;
endsubmit;
end;
submit;
proc printto;
run;
endsubmit;
quit
Thanks Rick. It seems it is TS1M1 as you mentioned. What you provided is marginally different from what I expected since I cannot use this way with other procedures together.
resetline;
ods html close;
ods graphics off;
ods listing;
proc printto log="Noname.txt";
run;
data DataSet;
do Variable=1 to 10;
put Variable;
end;
run;
proc printto;
run;
proc iml;
submit;
proc printto log="Noname.txt";
run;
%put Turn on PROC PRINTTO;
endsubmit;
do IMLVariable=1 to 30;
submit IMLVariable;
%put IMLVariable=&IMLVariable;
endsubmit;
end;
submit;
%put Turn off PROC PRINTTO;
proc printto;
run;
endsubmit;
quit;
proc printto log="Noname.txt";
run;
data DataSet;
do Variable=1 to 10;
put Variable;
end;
run;
proc printto;
run;
quit;
I must turn off and on printto procedures right before and after IML procedures.
I'm glad it works. Lucky guess on my part.
Two questions:
1. Why are you doing this? Is it because you are running a macro that calls many procedures that are filling up the log? If so, there might be a better way to program your task which is more efficient. You can also use ODS OUTPUT to supress output.
2. Since the default for PROC PRINTTO is to append, can't you just call PROC PRINTTO three times: 1. at the top of your program/macro, 2. inside PROC IML, and 3. at the end of your program/macro. I don't understand why you need to switch back and forth between the log and the LISTING. If you are trying to capture part of the output, you can use ODS OUTPUT to capture the tables you want as SAS data sets.
If this is part of a simulation study, you might want to view "Video: Ten tips for simulating data with SAS" or read the associated paper.
For 2, I need to go back and forth indeed because SAS cannot access to Noname.txt otherwise.
I saw this when I tried yours. I will check your other posts, thanks.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.