Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: AW: -findname- available from SSC

From   "Martin Weiss" <>
To   <>
Subject   st: AW: -findname- available from SSC
Date   Wed, 31 Mar 2010 15:37:05 +0200


" To give another example, 

findname, all(@ == 0 | @ == 1 | @ == .) 

is a way of finding all indicator variables, which are always 0 or 1 or

Could a dummy be "extended missing", as well?

set obs 2
gen byte mydummy=.a
replace mydummy=. in 2
findname, all(@ == 0 | @ == 1 | @ == .)

Would the syntax -findname, all(@ == 0 | @ == 1 | @ == missing(@))- cover
that, or rather: should it?


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Nick Cox
Gesendet: Mittwoch, 31. März 2010 14:52
Betreff: st: -findname- available from SSC

Thanks to Kit Baum, a new program -findname- is available on SSC. Stata
9 is required. To see full details, 

. ssc type findname.hlp

To install,  

. ssc inst findname 

-findname- is offered as a user-written alternative to official command

Many long-term members of this list will recall various discussions of
the status of -ds- culminating in the recent announcement by William
Gould on 3 March 
that -ds- was being restored to full official status, which was
implemented in the 9 March update to Stata 11 [NB].  

Just when you may have thought that matter was now cleared up after a
few years' grumbling from various users, here is something to complicate
things again. 

What's different? In a way, not much. -findname- has the same main aim
as -ds-, of finding variables that fit specified criteria. But clearly
the differences are what justify a new program. 

* Name. A program by any other name would not really be different, but
the name -ds- originally meant "short describe" and this role has long
since been submerged by the finding role. In addition, -describe,
simple- now does what -ds- did originally.  -find- is reserved by
statute for StataCorp, and in any case is so good a name that only a
really powerful or general command should be so named. After toying with
-findvars- I decided I liked -findname-. If you want to insist that it
should be -findvarname- or -findvarnames- or -findvarlist-, logic is
firmly on your side. 

* Syntax. -ds- has a rather ugly syntax centred on a -has()- option,
which I must have liked when I devised it, but no longer. My guess is
that most users of -findname- will find its syntax less idiosyncratic.
The syntax of -findname- now distinguishes more clearly between e.g.
finding out whether value labels are attached, what they are named, and
what is included in their text. 

* Functionality. -findname- has more flexibility, including the ability
to search value label and characteristic text as well as names. Options
-any()- and -all()-, which featured in -ds3- from SSC almost 10 years
ago, have been restored. (Maarten Buis reminded me a while back that
these had not made the cut to official -ds-.) So, for example, 

findname, all(@ == int(@)) 

finds all variables with only integer values. (Any string variables are
just ignored in a call like this.) To give another example, 

findname, all(@ == 0 | @ == 1 | @ == .) 

is a way of finding all indicator variables, which are always 0 or 1 or
missing. -type(byte)- would only in special cases catch all indicator
variables and only indicator variables. 

* Combining options. You can combine options, searching for those
variables with all of two or more criteria satisfied. -findname- finds
the intersection of sets. 

* Saving to locals too. That is likely to be handy on occasion in
identifying the union of sets. 

* Support for -if- and -in- where appropriate. 

That's it, really. I intend to write about the problem of finding
variables and about -findname- in particular in Stata Journal 10(2).
However much you extend the scope of a command like this, there are
always tasks for which you need to write your own code. 


*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index