R/Stata Can I include a categorical variable in a Logistic regression when one of its values perfectly predicts one of the outcomes? Suppose I have the following data
    df = data.table('y'= c(1,1,1,1,1,1,1,0,0,0,0), 'x' = c(1,1,1,1,1,1,1,1,1,0,0))

where x = 0 perfectly predicts y = 0. I thought this means that I can't include x as a regressor, but R apparently has no problem with this
    logitcontrol = list(maxit = 100)
    logitmodel <- glm(outcomevar ~., data = train_data, family = binomial(link = 'logit'),  control = logitcontrol)

    summary(logitmodel)

But Stata would drop the last two observations because x==0 perfectly predicts y==0, and then it would drop x because all that's left is x==1. Intuitively, I think Stata's solution makes sense, but how come R doesn't have a problem producing a result in this case? 
Also, in general, does it make mathematical sense to include a variable like x where one of the values of x perfectly predicts a value of the dependent variable? My intuition is 'no', but I'm not sure...
BTW, it doesn't make a difference if I add in another regressor say z.
 A: Q1 Stata would drop the last two observations because x==0 ...
In my opinion Stata's behaviour doesn't make any sense. If you include a variable in a regression model is because you don't know the relation between the predictor and the predicted. Your sample does not have all the population and, therefore, you cannot conclude $x=0 => y=0$. In fact if you predict the outcome for $x=0$ you don't obtain $0$ but $8\cdot10^{-9}$. If you would like a rule you should use another kind of model (decision tree, association rule,...)
Q2 Also, in general, does it make mathematical sense to include a variable like x where one of the values of x perfectly predicts a value of the dependent variable?
If you know for sure (100% of the cases) that $A=>B$ you should use that information before the model and get rid of that observations. For instance, it probably doesn't make sense to model the gas emissions of a car that is off (they are always 0). However, if that relation is uncertain, you should always include the predictor variable in the model (that is what statistics are about).
