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]
Re: st: Re: using categorical and continuous variables foreach loop for univaraite analysis
From
Phil Clayton <[email protected]>
To
[email protected]
Subject
Re: st: Re: using categorical and continuous variables foreach loop for univaraite analysis
Date
Tue, 9 Jul 2013 09:47:04 +1000
One simple solution is a slight tweak to your -foreach- syntax:
foreach x in i.cat1 i.cat2 i.cat3 i.cat4 con1 con2 con3 con4 {
logit outcome `x'
}
Phil
On 09/07/2013, at 8:51 AM, Michael Stewart <[email protected]> wrote:
> Hello all,
>
> In my research project, I have a number of categorical predictors(cat1
> cat2 cat3 cat4 ) and continuous predictors(con1 con2 con3 con4) and
> during initial uni-variate analysis, I am using two step process to
> evaluate for statistical significance.My code is a follows
>
> I use stata 12
>
> *********************MY CODE ********************
> foreach x of varlist cat1 cat2 cat3 cat4{
> logit outcome i.`x'
> }
>
> foreach x of varlist con1 con2 con3 con4{
> logit outcome `x'
> }
> ********************************************************
> Question:
>
> Is it possible to achieve this is one step i.e., use continuous and
> predictors as a single varlist but perform logistic regression still
> respecting the fact that some are categorical variables and some are
> continuous variables
>
> --
> Thank you in advance for your time and consideration,
> Yours Sincerely,
> Mike.
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/