Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Looping with regression controls |
Date | Thu, 1 Mar 2012 00:29:51 +0000 |
Your two commands fit the same model. The order of predictors affects only the presentation of results. Nick On Wed, Feb 29, 2012 at 10:51 PM, Ras Dondo <ras.dondo@yahoo.com> wrote: > 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? > * * 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/