Here is the SAS pgm for the simulation data + estimation based on simulation data for a conditional logit model/a discreta choice model.
The estimation uses the procedures both SAS canned procedure(proc MDC) and me written codes with SAS proc nlmixed.
The results are much each other from both approaches. The results are concured with simulation parameters.
******************************** ...
*verify the sample data;
proc corr data=err_extreme;
var e: ;
run;
data simudata;
set err_extreme;
***4 choices**;
seed= 6791534;
x1= rannor(seed); ***dependent on choice, cost/benefit of particular choice;
x2= rannor(seed); ***dependent on choice, cost/benefit of particular choice;
x3= rannor(seed); ***dependent on choice, cost/benefit of particular choice;
x4= rannor(seed); ***dependent on choice, cost/benefit of particular choice;
z1= ranuni(seed)-1.5; ***dependent on choice, cost/benefit of particular choice;
z2= ranuni(seed)-0.2; ***dependent on choice, cost/benefit of particular choice;
z3= ranuni(seed)-0.3; ***dependent on choice, cost/benefit of particular choice;
z4= ranuni(seed)-1.5; ***dependent on choice, cost/benefit of particular choice;
***choice related fixed cost/benefit only 3 can be identified;
max=max(u1,u2,u3,u4);
if u1=max then do;
choice=1;
z=z1;
x=x1;
end;
else if u2=max then do;
choice=2;
z=z2;
x=x2;
end;
else if u3=max then do;
choice=3;
z=z3;
x=x3;
end;
else do;
choice=4;
z=z4;
x=x4;
end;
keep z: x: choice;
run;
proc print data=simudata(obs=10);
run;
proc freq data=simudata;
table choice;
run;
****shape the data for sas procedure;
data simudata2;
set simudata;
array xv(4) x1-x4;
array zv(4) z1-z4;
retain pid 0;
pid + 1;
do i = 1 to 4;
mode = i;
decision = ( choice = i );
dmy1=(mode=1);dmy2=(mode=2);dmy3=(mode=3);dmy4=(mode=4);
xx =xv(i);
zz =zv(i);
output;
end;
keep dmy1 dmy2 dmy3 xx zz decision pid mode;
run;
proc print data=simudata2(obs=10);
run;
***write your own ML estimation of discrete choice model***;