[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: manage list of variables

From   Maarten buis <>
To   stata list <>
Subject   st: Re: manage list of variables
Date   Thu, 12 Nov 2009 21:30:23 +0000 (GMT)

--- 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. .

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
local varlist `r(varlist)'
local newlist: list varlist - except
di "`newlist'"
*----------- end example ------------

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index