2# peijiamei
data bb; input age income spend joinnow costhow choice ; cards; 3 45000 1000 1 1 3 4 20000 200 1 4 2 …… ;
data newdata(keep=pid decision mode age1 age2 age3 age4 income spend joinnow costhow1 costhow2 costhow3 );
set bb;
age1=(age=1);
age2=(age=2);
age3=(age=3);
age4=(age=4);
costhow1=(costhow=1);
costhow2=(costhow=2);
costhow3=(costhow=3);
retain pid 0;
pid + 1;
do i = 1 to 4;
mode=i;
decision = ( choice= i );
output;
end;
run;
proc mdc data=newdata type=mixedlogit;
model decision = income spend age1 age2 age3 age4 joinnow costhow1 costhow2 costhow3 /nchoice=4
mixed=(normalparm= income spend);/*或者是其他可能为正态分布的变量*/
id pid;
run;