Another solution I sometimes use is of the form:
sysuse auto, clear
foreach var of varlist _all {
local vl = "`vl' `var'"
}
local exclude "trunk weight disp length mpg make"
local vl: list vl - exclude
di "`vl'"
local
> 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?
>
> Thanks,
>
> Thomas
--
Douglas Owens
Economist
Welch Consulting
*
* 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/