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: stepwise - how to get list of names of variables selected?


From   "Eveline Nuesch" <Eveline.Nuesch@lshtm.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: stepwise - how to get list of names of variables selected?
Date   Fri, 31 Aug 2012 09:47:19 +0100

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/


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