/*Kaz's SAS juku course*/ /*www.estat.us*/ /*Kaz's SAS juku*/ /*www.estat.us*/ /*PROC NLMIXED*/ /*Multilevel Logitic Regression/HGLM using NLMIXED*/ /*In my experiences NLMIXED is hard to make it converge. It seems that you need to have a damn good model to make it work. I feel GLIMIX macro is more useful because it allows more than 2-levels, while NLMIXED is only for 2-levels*/ data ABC; set sashelp.Prdsal3; ****************; sales_goal_achieved=0; if predict < actual then sales_goal_achieved=1; ****************; run; proc nlmixed data=ABC ; parms a=2.5 s2u=0.5 beta1=-0.00288; eta=a + beta1*PREDICT + u ; expeta=exp(eta); p=expeta/(1+expeta); model sales_goal_achieved~ binary(p); random u ~ normal(0,s2u) subject=state out=residual_file; ods output ParameterEstimates=results_file; run; proc print data=results_file; title "Results"; run; proc print data=residual_file; title "residual anlaysis"; run;