Statalist


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

Re: st: Re: manage list of variables


From   joachim jarreau <joachim.jarreau@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: manage list of variables
Date   Thu, 12 Nov 2009 22:50:24 +0100

yes! perfect. thanks a lot

joachim



On Thu, Nov 12, 2009 at 10:30 PM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- 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/



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