<>
Thanks for the plug! If the "except" is not just a -varname-, but a -varlist-, -unab- could be handy for Joachim.
HTH
Martin
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Maarten buis
Sent: Donnerstag, 12. November 2009 22:30
To: stata list
Subject: st: Re: manage list of variables
--- joachim jarreau wrote:
> Id like to know if there exists a way to create
> a local list of the existing variables in a dataset,
> In other words id need to do something like :
> collapse (sum) value, by( "all variables except this-that").
you can get a list of variables using the -ds- command, see: 
-help ds- and Martin Weiss (2008) Stata tip 66: ds—A hidden 
gem. The Stata Journal, 8(3):448-448. 
http://www.stata-journal.com/article.html?article=dm0040 .
You can remove a set of variables from that list using extended 
macro functions, see -help macrolists- and the example below:
*-------- begin example -------------
local except "make"
sysuse auto, clear
ds 
local varlist `r(varlist)'
local newlist: list varlist - except
di "`newlist'"
*----------- end example ------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
      
*
*   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/
*
*   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/