Couple of things that should lead you in the right direction.
First, pre-create your full destination matrix; don't concatenate constantly. So, once your read the dataset into x
, make another x_new
that is the same number of rows as x
but has 11 columns. j
will do this for you.
Second, you can make all of your random numbers at once, but you have to initially define the size of the matrix to fill, again using j
. This is assuming you want a new random integer for each of the 10 columns AND each of the rows; if you want just each of the rows or just one 'm' in total you need to do this differently, but you need to clarify that. If you just want one row of 10 m's, then you can do that first (generate a u
that has 10 columns 1 row) then expand that to the full number of rows of x using matrix multiplication.
Here's a simplified example using SASHELP.CLASS showing these two concepts at work.
proc iml;
use sashelp.class;
read all var {age weight} into x;
x_new = j(nrow(x),11); *making the new matrix with lots of columns;
x_new[,1] = x[,1]; *copy in column 1;
call randseed(123);
u = j(nrow(x),10); *make the to be filled random matrix;
call randgen(u,'Uniform',68,300); *the min/max parameters can go here;
u = floor(u+0.5); *as Rick noted in comments, needed to get the max value properly;
x_new[,2:11] = u[,1:10] + x[,2]; *populate x_new here;
print x_new;
quit;