I am new to STATA.

I know how to run logistic regressions individually and to predict values and residuals. I want to know how I can do this in a for loop.

If I have a y-variable and multiple x-variables, how can I run multiple Logistic regressions and predict the values and residuals. Specifically, how can I do the following in a loop:

logit y-variable x-variable1
predict values1
predict residuals1, res

logit y-variable x-variable1 x-variable2
predict values2
predict residuals2, res

logit y-variable x-variable1 x-variable2 x-variable3
predict values3
predict residuals3, res

logit y-variable x-variable1 x-variable2 x-variable3 x-variable4
predict values4
predict residuals4, res