BookmarkSubscribeRSS Feed
telescopic
Calcite | Level 5

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;

1 REPLY 1
Rick_SAS
SAS Super FREQ

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...

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
  • 1 reply
  • 766 views
  • 0 likes
  • 2 in conversation