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

Re: st: Searching for words in strings


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   Re: st: Searching for words in strings
Date   Tue, 14 Oct 2003 19:22:15 +0100

John Wallace

> I'd like to search a comment field for a specific word, such as can
be done
> with Excel's "Search(find_text,within_text,[start_num])" function.
I'd like
> to do it interactively, rather than as a program (it looks like a
program
> using -tokenize- would be one approach), but the -match- and -word-
string
> functions don't appear to be what I'm looking for.  I have a list of
1000
> records, all with a "comment" field that may or may not contain a
word I
> want, buried within an otherwise random string of characters.  What
I'd like
> is a command that I could type in thus:

> .browse if {command}("wafer",var_comment) !=.

> Does such a command exist?  It seems like it would be a useful tool
for
> browsing non-standard text fields...

Indeed. Or rather, -index()-.

. browse if index(var_comment, "wafer")

For more, see the relevant help or
Stata Journal 2(4), 411-427 (2002), esp. Section 2.2.

Nick
[email protected]

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index