Binary Data Modeling
/*--------------------------------------------------------------
SAS Sample Library
Name: mdcex01.sas
Description: Example program from SAS/ETS User's Guide,
The MDC Procedure
Title: Binary Data Modeling
Product: SAS/ETS Software
Keys: multinomial discrete choice
PROC: MDC
Notes:
--------------------------------------------------------------*/
data smdata;
input gpa tuce psi grade;
datalines;
2.66 20 0 0
2.89 22 0 0
3.28 24 0 0
2.92 12 0 0
4.00 21 0 1
2.86 17 0 0
2.76 17 0 0
2.87 21 0 0
3.03 25 0 0
3.92 29 0 1
2.63 20 0 0
3.32 23 0 0
3.57 23 0 0
3.26 25 0 1
3.53 26 0 0
2.74 19 0 0
2.75 25 0 0
2.83 19 0 0
3.12 23 1 0
3.16 25 1 1
2.06 22 1 0
3.62 28 1 1
2.89 14 1 0
3.51 26 1 0
3.54 24 1 1
2.83 27 1 1
3.39 17 1 1
2.67 24 1 0
3.65 21 1 1
4.00 23 1 1
3.10 21 1 0
2.39 19 1 1
;
data smdata1;
set smdata;
retain id 0;
id + 1;
/*-- first choice --*/
choice1 = 1;
choice2 = 0;
decision = (grade = 0);
gpa_2 = 0;
tuce_2 = 0;
psi_2 = 0;
output;
/*-- second choice --*/
choice1 = 0;
choice2 = 1;
decision = (grade = 1);
gpa_2 = gpa;
tuce_2 = tuce;
psi_2 = psi;
output;
run;
proc print data=smdata1(obs=10);
var decision choice2 gpa_2 tuce_2 psi_2;
id id;
run;
/*-- Conditional Logit --*/
proc mdc data=smdata1;
model decision = choice2 gpa_2 tuce_2 psi_2 /
type=clogit
nchoice=2
covest=hess;
id id;
run;
/*-- Multinomial Probit --*/
proc mdc data=smdata1;
model decision = choice2 gpa_2 tuce_2 psi_2 /
type=mprobit
nchoice=2
covest=hess
unitvariance=(1 2);
id id;
run;