Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: searching string variables


From   David Kantor <dkantor@jhu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: searching string variables
Date   Tue, 29 Jun 2004 17:22:59 -0400

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
dkantor@jhu.edu
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/



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