Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: a reverse wildcard or other way to mean "all variables but..."


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: a reverse wildcard or other way to mean "all variables but..."
Date   Fri, 29 Jun 2012 17:12:46 +0100

ds ID, not

collapse `r(varlist)', by(ID)

or use -findname- (SJ, SSC)  to the same effect.

Nick


On Fri, Jun 29, 2012 at 4:56 PM, Doug Hess <douglasrhess@gmail.com> wrote:
> I thought I was being smart and quick with the following one-liner
>
> -collapse *, by(ID)-
>
> But, of course, the variable named ID is included in the wildcard
> before the comma, which means the command gives the error statement
> "control may not be both target and by()." I'm not sure if the
> solution is some reverse of the wildcard or way to say: _all "but
> don't include ID when I say _all".   I guess one can just include all
> the variables in a - local - or -global- and then hunt for and remove
> the one variable you want left out. But is there a code for
> subtracting something from * or _all on the fly, so to speak?
>
> Thank you. I'm on the list in digest mode, so if replies can cc me,
> that would helpful.
>
> [P.S. I found this discussion in the archive, but it's not exactly the
> same issue: http://www.stata.com/statalist/archive/2008-10/msg00507.html
> ]

*
*   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   |   Site index