Hi all,
I am trying to generate a table with 100 observations, one variable. This is a discrete variable with 4 levels so I used this code below and everything is fine.
data BMI (drop = i) ;
array prob [4] (0.01, 0.1, 0.26, 0.63);
call streaminit(1234);
do i = 1 to 100;
BMI = rand("Table", of prob);
output;
end;
run;
quit;
However, what I really want is this to store the proportions (0.01, 0.1, 0.26, 0.63) in a matrix variable z, like this below, and then pass that matrix variable via array, prob
into the rand function, as shown below.proc iml;
use CHIS.RBMI_Freq;
read all var {PERCENT} into XBMI ;
Z = ((XBMI[1:4,])*.01);
print Z;
run;
data BMI (drop = i) ;
array prob Z ;
call streaminit(1234);
do i = 1 to 100;
BMI = rand("Table", of prob);
output;
end;
run;
quit;
When I do this I get an error Argument 2 to function RAND('Table',.) at line 822 column 15 is invalid.
I need help. Thanks in advance.