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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: deleting variables based on a certain condition


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: deleting variables based on a certain condition
Date   Tue, 3 Apr 2012 18:54:32 +0100

-findname- was recently updated in SJ 12(1) 2012 and on SSC. That was
announced on this list in

http://www.stata.com/statalist/archive/2012-03/msg00597.html

and should be evident from -search findname- in an up-to-date Stata
12. You need to look at the archives and also to update your copy of
-findname-.

Here is a way to do it with -findname-. No "addition" is needed.

sysuse auto, clear
gen FOO = 42

findname, all(regexm("@", "[A-Z]+")) local(SHOUTED)
FOO

drop `SHOUTED'

The local macro -SHOUTED- consists of names that you want.

That's a bit of an awkward way to do it, but still a way to do it.

Nick

On Tue, Apr 3, 2012 at 6:32 PM, Abhimanyu Arora
<abhimanyu.arora1987@gmail.com> wrote:
> Dear statalist and Nick
>
> I have certain variables the names of which are in capitals. I would
> like to delete them altogether.
>
> Basically I am looking for a something in addition to what SSC's
> findname by Nick Cox does. Perhaps Nick has a newer version or somehow
> this one can suffice?
>
> . which findname
> c:\ado\plus\f\findname.ado
> *! 1.0.1 NJC 28 April 2010
> *! 1.0.0 NJC 30 March 2010
*
*   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