Statistical programming, matrix languages, and more

The Use of Submit-Endsubmit with Proc Printto?

Reply
Occasional Contributor
Posts: 19

The Use of Submit-Endsubmit with Proc Printto?

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.

1.png

Thanks in advance.

SAS Super FREQ
Posts: 4,042

Re: The Use of Submit-Endsubmit with Proc Printto?

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
Occasional Contributor
Posts: 19

Re: The Use of Submit-Endsubmit with Proc Printto?

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.

SAS Super FREQ
Posts: 4,042

Re: The Use of Submit-Endsubmit with Proc Printto?

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.

Occasional Contributor
Posts: 19

Re: The Use of Submit-Endsubmit with Proc Printto?

For 2, I need to go back and forth indeed because SAS cannot access to Noname.txt otherwise.

2.png

I saw this when I tried yours. I will check your other posts, thanks.

Ask a Question
Discussion stats
  • 4 replies
  • 154 views
  • 2 likes
  • 2 in conversation