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: stepwise - how to get list of names of variables selected?
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: stepwise - how to get list of names of variables selected?
Date
Fri, 31 Aug 2012 09:56:04 +0100
. search stepwise, faq
. ssc desc indeplist
Nick
On Fri, Aug 31, 2012 at 9:47 AM, Eveline Nuesch
<[email protected]> wrote:
> I am using "stepwise" to perform variable selection in logistic
> regression in 200 simulated datasets. I would like to automatically get
> a list of names of the variables selected (potentially different in each
> dataset) to run subsequent regressions.
>
> Does "stepwise" save this somewhere? If yes, how can I access it?
>
> *My code so far:
>
> foreach i in 1/200 {
> use data_`i', clear
> stepwise , pr(.05): logistic y x1 x2 x3 x4 x5 // selects predictor
> variables (e.g. x2 x3 x5)
> local xlist_`i' ??? // How can I get this list in an automated
> fashion?
> logistic y* `xlist'
> }
>
> Any ideas or suggestions are very much appreciated.
> Many thanks.
> Eveline Nüesch
> *
> * 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/
*
* 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/