Thank you Rick! I have refined the simulation code such that probabilities sum to one and RAND("TABLE", mu1, mu2, mu3) consistently generates three treatment levels. Next challenge is to create a system of equations to find beta01, beta02, and beta03 which would in turn help to create balanced or unbalanced design by a predetermined level.
option symbolgen;
%let N = 300; *total obs;
%let beta11 = log(7); *relationship of covariate X with T=1;
%let beta12 = log(5); *relationship of covariate X with T=2;
%let beta13 = &beta11 - &beta12; *relationship of covariate X with T=3;
data Sim;
array x123{&N} _temporary_;
call STREAMINIT(1982);
do i=1 to &N;
x123{i} = RAND("NORMAL", 0, 1);
x = x123{i};
**Section 1. define linear equations;
eta12 = beta03 + &beta13 * x;
eta23 = beta02 + &beta12 * x;
eta13 = beta01 + &beta11 * x;
**Section 2. define probabilities for each treatment group
as a function of linear equations in section 1;
mu1 = exp(eta13) / (1 + exp(eta13) + exp(eta23));
mu2 = exp(eta23) / (1 + exp(eta13) + exp(eta23));
mu3 = 1 / (1 + exp(eta13) + exp(eta23));
** check if probabilities sum to 1;
mut = mu1 +mu2 +mu3;
** Section 3. simulate treatment status for each individual
given their probabilities in section 2;
t = RAND("TABLE", mu1, mu2, mu3);
output;
end;
run;
... View more