Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: substring search


From   "Rosy Reynolds" <[email protected]>
To   <[email protected]>
Subject   Re: st: substring search
Date   Mon, 13 Feb 2006 08:28:14 -0000

It is particularly useful to hear of the -index- function because it does not seem to be in the documentation for Stata 9 (through help, search, or the printed manuals under string functions), although -indexnot- is described.
Rosy

----- Original Message ----- From: "David Harless" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 12, 2006 8:50 PM
Subject: Re: st: substring search



Andy Choi wrote:
Hi, I am a beginner at STATA.  I am cleaning a
medication file, and I was wondering if anyone knew
how to search for a substring without specifying its
position in the string.  Thanks, Andy

Try the -index- function as in
list if index(var_name,"ABC")
or creating an indicator variable
gen has = (index(var_name,"ABC"))

I hope this helps.
Dave Harless
*
* 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/
*
*   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