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

Re: st: AW: listing variables with certain characteristics

From   Jeph Herrin <>
Subject   Re: st: AW: listing variables with certain characteristics
Date   Thu, 27 Aug 2009 15:18:31 -0400

My esteem of Nick not withstanding, his assertion:

 "7. -ds- remains an official command. There is absolutely
  nothing unofficial about it."

is contradicted in my mind by the first line of the
help file in Stata 11:

 "ds continues to work but, as of Stata 9, is no longer an official
  part of Stata."

Now, if "official" is a dichotomous state, and StataCorp is
the ultimate arbiter of what is official and what is not, I would
have to say that Nick's "absolutely" might be unwarranted.


Martin Weiss wrote:

"-ds- seems to be on the verge of extinction."

See Nick`s recent statement number 7 to the contrary here:


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Jeph Herrin
Gesendet: Donnerstag, 27. August 2009 21:02
Betreff: st: listing variables with certain characteristics

I have often found it helpful to keep track of
metadata associated with variables by assigning
it as characteristics. So, for instance, a variable
which is of type checkbox, in module 6, question 3
of a survey might have

    myvar[type]:        checkbox
    myvar[module]:      6
    myvar[question]:    3

and so on. What I'm looking for is a good way to
generate a list of variables that have, eg, module=6.

Right now, the best I can do is

   ds, has(char module)

to get the list of variables that have a "module"
characteristic, then loop over that list to pick
out the ones where module=6. This bothers me because
(a) it seems there should be a better way than looping
and (b) -ds- seems to be on the verge of extinction.

I'm about to write  my own utility to do this, since
I need to do it so often, but thought I'd see if there
wasn't a better way already out there. Is there a
a direct way to get a list of variables where the
characteristic exists and has a certain value?


*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

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