/* Program from http://www.ats.ucla.edu/stat/sas/dae/mlogit.htm */
/* Entering High School students make program choices among general program (prog = 1), academic program (prog = 2),
and vocational program (prog = 3). Their choice is likely to depend on aptitude scores and social
economic status among other variables. */
/* The higher the math, reading, writing, science, and social science test scores, the greater the
academic aptitude. The more awards and the participation in honors, the greater the academic
aptitude. The socio-economic status is probably calibrated as 1 = lowest while 3 = highest. */
data highschool;
set "c:\data\hsbdemo";
run;
proc contents data = highschool;
run;
proc freq data = highschool;
tables prog female ses schtyp honors;
run;
proc freq data = highschool;
tables prog*ses / chisq norow nocol nofreq;
run;
proc freq data = highschool;
tables prog*schtyp / chisq norow nocol nofreq;
run;
proc means data = highschool;
var write;
by prog;
run;
proc means data = highschool;
var math;
by prog;
run;
proc means data = highschool;
var science;
by prog;
run;
proc means data = highschool;
var ses;
by prog;
run;
proc means data = highschool;
var awards;
by prog;
run;
proc logistic data = highschool;
class prog (ref = "2") ses (ref = "1") / param = ref;
model prog = ses write / link = glogit;
run;
proc logistic data = highschool;
class prog (ref = "2") ses (ref = "1") schtyp (ref = "1") / param = ref;
model prog = ses schtyp female awards honors read write math science socst / link = glogit selection = stepwise;
score out=result;
run;
proc print data = result;
run;
data result;
set result;
if F_prog = I_prog then acc = 1;
else acc = 0;
run;
proc print data = result;
var F_prog I_prog acc;
run;
proc means data = result;
var acc;
run;