Statalist The Stata Listserver


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

Re: st: substring search


From   David Harless <[email protected]>
To   [email protected]
Subject   Re: st: substring search
Date   Sun, 12 Feb 2006 15:50:08 -0500

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/



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