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]

st: RE: How to get a list of the names of characters associated with a variable


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: How to get a list of the names of characters associated with a variable
Date   Thu, 4 Mar 2010 21:42:43 +0100

<>

Are you aware of community efforts such as

*******
ssc d lookfor_all
ssc d lookforit
*******

?

HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Clyde Schechter
Sent: Donnerstag, 4. März 2010 21:20
To: statalist@hsphsun2.harvard.edu
Subject: st: How to get a list of the names of characters associated with a
variable

I'm trying to write an ado file that will generalize the -lookfor- command
so that it also searches for the target text in characters associated with
variables.  (I need this because I have a data set with a large number of
variables, and the key information is often found not in the label [which
was truncated at 80 characters], but in a character--and the characters
are not consistently named.)

So my basic idea is:

foreach v of varlist _all {
     get a list of all characters associated with `v' in a local char_list
     foreach c of local char_list {
          if index("`:char `v'[`c']'", "`target_string'") > 0 {
               found it -- generate suitable output
          }
     }
}

But I haven't found a way to get a list of all characters associated with
`v'.  I can display them all with - char list `v'[] -, but that doesn't
return anything.

Anyone have any ideas about this, or an alternative way for me to
generalize -lookfor-?  Thanks in advance for any help.

Clyde Schechter, MA MD
Associate Professor of Family & Social Medicine
Albert Einstein College of Medicine, Bronx, NY, USA

Please note new e-mail address: clyde.schechter@einstein.yu.edu

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