BookmarkSubscribeRSS Feed
Junyong
Pyrite | Level 9

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.

4 REPLIES 4
Rick_SAS
SAS Super FREQ

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
Junyong
Pyrite | Level 9

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.

Rick_SAS
SAS Super FREQ

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.

Junyong
Pyrite | Level 9

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 870 views
  • 2 likes
  • 2 in conversation