Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
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/