Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Looping with regression controls
From
Ras Dondo <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Looping with regression controls
Date
Wed, 29 Feb 2012 14:51:55 -0800 (PST)
Dear All,
I am new to Stata and having difficulty fitting a
model. I have one dependent variable RECOVER coded 0 or 1. I also have
10 independent categorical variables AGE, EDUCATION, RELIGION, MARITAL,
SOC_CLASS, COUNTRY_BIRTH, EMPLOYMENT, YEARS_WORKED, NO_PARTNERS, and
FAMILY_SIZE. I wish to model the effect of each sociodemographic
variable on the dependent variable RECOVER whiles controlling for the
remaining nine independent variables. First time round I wish to model
the effect of AGE on RECOVER whiles controlling for the remaining nine
variables as below.
xi: logistic RECOVER i.AGE i.EDUCATION
i.RELIGION i.MARITAL i.SOC_CLASS i.COUNTRY_BIRTH i.EMPLOYMENT
i.YEARS_WORKED i.NO_PARTNERS i.FAMILY_SIZE
Second time round I
will wish to model the effect of EDUCATION on RECOVER whiles controlling
for the remaining nine variables as below.
xi: logistic RECOVER i.EDUCATION i.RELIGION i.MARITAL i.SOC_CLASS
i.COUNTRY_BIRTH i.EMPLOYMENT i.YEARS_WORKED i.NO_PARTNERS i.FAMILY_SIZE i.AGE
My
question is instead of repeating the logistic command is it possible to
write one command maybe using looping that will let me avoid the
repetition?
Ras
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/