Last week I got some help with allocating memory for very large IML arrays. The post got deleted by accident so I thought I'd repost to assist those trying to do that.
In short, IML 14.1 supports matrices with up to 231 elements on the Windows operating system.
I upgraded to 14.1 and have sufficient RAM but a simple "y = j(33000,33000,1);" wasn't working for me.
IIRC, Rick Wicklin suggested adding "-MEMSIZE 12G" to the shortcut I start SAS with.
I went a little deeper and edited that configuration into my SASv9.CFG file and now I can allocate large arrays on my Win7 16GB RAM machine. Thanks, Rick!
Incidentally, this lets me run much larger Monty Hall simulations -- up to a quarter of a billion sims -- see attached code & results below based on Rick's "DO Loop" Monty Hall example -- and remember to "switch doors"!
proc iml;
t0 = time();
NumSim = 2.5e8; /* number of simulated games */
car = randfun(NumSim, "Table", {1 1 1}/3); /* unknown door hides car */
guess = j(NumSim, 1, 1); /* WLOG, you guess door=1 */
show = choose(car=2, 3, 2); /* host shows you a goat --> if car behind 2 then 3 else 2 */
switch = choose(show=2, 3, 2); /* the door you could switch to -- if host shows 2 then 3 else 2 */
winIfSwitch = mean(switch=car); /* (P(win | switch) */
winIfStay = mean(guess=car); /* (P(win | do not switch) */
elapsedTime = time() - t0;
print "Monty Hall: NumSim = " NumSim[format=comma12. label=EMPTY] winIfStay[format=8.6 rowname=" p(WinIfStay)" label=EMPTY] winIfSwitch[format=8.6 rowname=" p(WinIfSwitch)" label=EMPTY] " Time in Seconds = " elapsedTime[format=4.1 label=EMPTY];
Monty Hall: NumSim = 250,000,000 | p(WinIfStay) 0.333347 | p(WinIfSwitch) 0.666653 | Time in Seconds = 11.1 |
Completely off topic-- @stevo642, how did you get access to 14.1?
Steve Denham
It was released last week!
Here's the What's New for the Analytical products: SAS 14.1 Documentation
And here's highlights: SAS Analytics: Highlights of 14.1, 13.2, 13.1, and 12.1 Releases
Hmm--I would have thought that there would have been a large splash headline on the Communities page...
Steve Denham
Wait for it...coming soon!
I got IML 14.1 when upgraded from 9.4 (TS1M1) to 9.4 (TS1M3)
I wrote a blog post that describes this issue and the way to resolve it:
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.