Performing logistic regression for a subset of the population


New Member
Hi there!

I am using Stata for the first time and fumbling through. I am comfortable performing a logistic regression and producing odds ratios, but now I want to divide my population by one of my variables and then perform the regression. For example, I have a binary variable and I want to do the regression for only those people who responded 'yes' to that variable, then separately for those who responded 'no'. Can anyone give me some guidance on this. I hope it makes sense!!!

Thanks in advance!


Use -if-, eg:
logistic ... if response=="Yes", ...

Or, use -by-:
by response: logistic ...
(you would probably need to -sort response- first)