thanks everyone for the suggestions. one thing i noticed: since the rand(table) and ranuni functions are really random, im not always guaranteed that predetermined mixture everytime I run the code. I just realized that after posting this topic. I came up with this code to get me close to the predetermined mixture (if a perfect separation is not possible I just round the numbers). what do you guys think? is there a more efficient way to write the do loop - perhaps combining both do loops to say from i=1 to round(&n*&p0) do blah then from i=round(&n*&p0) +1 to round(&n*(1-&p0) do blah %macro zeroones(n=,p0=,seed=); data zeroones; do i=1 to round(&n*&p0); x=0; y=ranuni(&seed); output; end; do i=1 to round(&n*(1-&p0)); x=1; y=ranuni(&seed); output; end; run; proc sort data=zeroones out=zeroones(drop=i y); by y; run; %mend zeroones; %zeroones(n=20,p0=.36,seed=12489); proc freq data=zeroones; tables x; run;
... View more