Statalist


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

st: AW: listing variables with certain characteristics


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: listing variables with certain characteristics
Date   Thu, 27 Aug 2009 21:08:10 +0200

<>




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

See Nick`s recent statement number 7 to the contrary here:
http://www.stata.com/statalist/archive/2009-08/msg00899.html




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Jeph Herrin
Gesendet: Donnerstag, 27. August 2009 21:02
An: statalist@hsphsun2.harvard.edu
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?

thanks,
Jeph

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