In reply to Rick Wicklin.

Rick,
I was able to make it work following your DO-loop in this example. I guess the key was defining the M vector, first with missing values. Then in the DO loop, assign M value at each ith row. Code works now. Thanks for all your examples in your blog. -Richard

====== working code ====
proc iml;

sim=j(5,10);
call randgen(sim, "Normal",100,0.5);

M = j(5,1,.);

sim_mean = sim[,:];

do i = 1 to 5;
if sim_mean[i] > 100 then M[i]=1;
else M[i]= 2;
end;

print M;

quit;