I am using SAS in order to predict the probability that a borrower will default on his loan based on his age group. The variable age is divided in to 4 age groups.

group 1 has 1315 customers and out of them 152 defaulted (11.6%)

group 2 has 5527 customers and out of them 360 defaulted (6.51%)

group 3 has 4134 customers and out of them 152 defaulted (4.11%)

group 4 has 2885 customers and out of them 72 defaulted (2.5%)

I ran a logistic regression in SAS where category 4 is treated as the base category receiving a coefficient 0 while the coefficients for groups 1,2,3 are 0.8435,0.2144 and -0.2709 respectively, the intercept is -2.8783. The thing that does not make sense to me is the sign of the coefficient of group 3.I don't understand how can it be negative if this group has higher default rates then group 4, I mean wouldn't the negative value imply that a customer in group 3 has lower log odds then a customer in group 4? is this possible given we now that group 3 has more defaults? I am still not sure if my mistake/misunderstanding is related to statistics or this may be some technical mistake in my SAS code. I doubled checked the code, it seems that the coding is correct.


1 Answer 1


I suspect it is your use of SAS, not the model. I tried to reconstruct your data and run it through R:

dats <- data.frame(group=rep(as.character(1:4), c(1315, 5527, 4134, 2885)), defaulting=0)
dats$defaulting[1:152] <- 1
dats$defaulting[1316:(1315+360)] <- 1
dats$defaulting[(1315+5527+1):(1315+5527+152)] <- 1
dats$defaulting[(1315+5527+4134+1):(1315+5527+4134+72)] <- 1
dats$group <- factor(dats$group, levels=c("4", "1", "2", "3")) # puts group "4" as reference
table(dats) # check data setup: fine

fm <- glm(defaulting ~ group, data=dats, family=binomial)

The (snipped) output is:

            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -3.6653     0.1193 -30.711  < 2e-16 ***
group1        1.6305     0.1473  11.073  < 2e-16 ***
group2        1.0014     0.1312   7.632 2.31e-14 ***
group3        0.3997     0.1452   2.753   0.0059 ** 

All estimates are positive, relative to group 4, as you wrote you'd expect them. I am not familiar with setting the intercept of group 4 to 0. Since the exponentiated estimates are interpretable as odds ratio, I am fairly happy with this output.

  • $\begingroup$ thanks fro the answer, $\endgroup$
    – leeneumann
    Feb 11, 2020 at 14:24
  • $\begingroup$ thank you very much for the help, I will review the code again. I read posts about people saying that logistic regression output is different in R and SAS when used on the same data, in your opinion could there be a situation where a code is correct and the two software's are giving different results because the optimization technique is different? $\endgroup$
    – leeneumann
    Feb 11, 2020 at 14:32
  • $\begingroup$ Most certainly not. The likelihood of this problem is simple and smooth, so optimisation should not be a source of difference. Maybe you want to post your SAS code for comparison? It's been a while that I regularly used SAS, though. $\endgroup$
    – Carsten
    Feb 12, 2020 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.