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" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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 <[email protected]> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index