Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Looping with regression controls


From   Ras Dondo <ras.dondo@yahoo.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index