At 02:12 PM 6/29/2004 -0700, Daphna wrote:
Hello all-
I have a very basic question related to string variables, which I cannot
seem to resolve. I apologize if this is too basic.
I need a way to essentially search through string variables the way you
would use the "find" command in excel.
For instance, I have a long list of school names. Some of them may have
the word Alternative (or some part thereof is alt, alterna. erc) within
their name (but it wouldn't necessarily be the first part or last part of
their name) How can I find these.
Right now I am literally exporting to excel and using the find command,
but I am sure there is an easier way.
Thanks so much for the help.
Sincerely,
Daphna
You want to look at the value of something like...
index(schoolname, "Altern")
... looking for when the value is positive.
To make it case-insensitive, do this:
index(upper(schoolname), "ALTERN")
See -help strfun- for more info.
I hope this helps.
-- David
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/