Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: excluding variables from varlist


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: excluding variables from varlist
Date   Thu, 25 May 2006 21:21:06 +0100

No, although the obvious reason 
is the -foreach- syntax downstream. 

ds a b c, not 
foreach var in `r(varlist)' { 
	...
} 

You could go 

foreach var of var `r(varlist)' { 

but I can't see any advantage in that. 
Signalling -var- ensures that an 
abbreviated varlist is unabbreviated, 
but -ds- does that for you. 

-ds- remains documented on-line in Stata 9. 

Nick 
n.j.cox@durham.ac.uk 

M Hollis
 
> I've just learned about the existence of -ds- from a
> previous statalist post, but would this also work?
> 
> ds a b c, not
> foreach var in varlist `r(varlist)' {
> ....
> }
> 
> 
> --- Thomas <thomas.triebs@econ.cam.ac.uk> wrote:
> 
> > Hi,
> > 
> > using the foreach command I would like to exclude
> > certain variables, e.g:
> > "foreach var of varlist _all [/excluding a, b, c/]".
> > 
> > Is that possible and if so how?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index