Statistical programming, matrix languages, and more

pause during iteration

Reply
Occasional Contributor
Posts: 15

pause during iteration

Question1) When I run the following iteration at SAS/base, the log window won't pause. I want to see the 'z' result at each iteration k. How can i do that?

If I am correct, command 'pause;' work only inside a module.

Question 2) Does it exist a summary listing or explorer telling the matrices' size in SAS/iml, like Matlab? I always use 'print' , but it's not convenient.

Thanks you

-----------------------------------------------

proc iml;
reset log print;
use Myfile var{a b c d};
names={a b c d};
read all into X[colname=names];


use Myfile var{e};
names={e};
read all into r[colname=names];


%let H=5;
%let d_plus1=7;
W= (uniform( repeat(0,&H,&d_plus1) )*0.02)-0.01;  /*generate uniform random matrix*/
V= (uniform( repeat(0,&H,1) ) )*0.02-0.01;

do k=1 to 50;
z=1/( 1+EXP(-W*(X`)) );           /*I want to see this result at every k value*/

end;

SAS Super FREQ
Posts: 3,615

pause during iteration

Well, if that's really what you want, you can wrap a little module around the loop like this: 

start foo;

do k=1 to 50;

   z=1/( 1+EXP(-W*(X`)) ); /*I want to see this result at every k value*/

   pause;

end;

finish;

run foo;

Alternatively, just print all the values and then scroll up in the output window.

 

2) You might want the SHOW command: http://blogs.sas.com/iml/index.php?/archives/142-Listing-SASIML-Variables.html

 

3) In SAS/IML Studio (which is good for beginners), you can use the pause in "open code" (=not in a module). See http://blogs.sas.com/iml/index.php?/archives/123-How-to-Learn-SASIML-Five-Resources-for-the-Beginner...

Ask a Question
Discussion stats
  • 1 reply
  • 243 views
  • 0 likes
  • 2 in conversation