# manipulating arrays in SAS

English is not my first language. Here are my questions.

I am using proportions ((0.1, 0.25, 0.25, 0.4) to generate 4 classes of data (1 variable 4 levels) in SAS based on the code below,

data NativeBMI (drop = i) ;
array prob [4] (0.1,0.25,0.25,0.4);

call streaminit(1234);
do i = 1 to 100;
BMI = rand("Table", of prob[*]);

output;
end;
run;


I have no problem with this code above. However, if I change the line from

    array prob [4] (0.1, 0.25, 0.25, 0.4);
call streaminit(1234);
do i = 1 to 100;
BMI = rand("Table", of prob[*]);


to

    array prob [4] z;
call streaminit(1234);
do i = 1 to 100;
BMI = rand("Table", of prob[*]);


it doesn't work.

My goal is to use a set of proportions saved in an array elsewhere (in this example z) and pass that array (z) into the rand function

     rand("Table", of ...);