Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: How to identify multiple substrings within a string
From
ToveLysa Fitzgerald <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: How to identify multiple substrings within a string
Date
Wed, 16 Jan 2013 08:36:23 +1100
Thank you, that piece of code picked up nil/no/denies cases but it also picked up some cases where nil/no/denies was completely irrelevant to the term diarrhoea as these terms preceeded a large amount of text prior to the occurrence of diarrhoea. Is there any way you can refine the code to limit the number of characters/spaces that occur between the terms nil/no/denies and diarrhoea?
Tove Fitzgerald
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ryan Kessler
Sent: Monday, 14 January 2013 12:03 PM
To: [email protected]
Subject: Re: st: How to identify multiple substrings within a string
input str30 string
"diarrhoea"
"nil diarrhoea"
"no vomiting/diarrhoea"
"denies diarrhoea/vomiting"
end
gen nodi = regexm(lower(string), "(nil |no |denies )(.*)(diarrhoea)") tab nodi
Best,
Ryan Kessler
On Sun, Jan 13, 2013 at 6:37 PM, Michelle T. Butler <[email protected]> wrote:
> Hi all, I am searching a string variable for cases who don't have diarrhoea.I need to identify records where the terms nil, no or denies preceeds the term diarrhoea in the same sentence.I have already identified that these terms do not always immediately preceed diarrhoea eg. No vomiting/diarrhoea, so I am looking for a way to extract all observations where nil, no, denies occurs in close proximity to diarrhoea, ignoring spelling errors/upper/lower case variations etc.Thank you for your help,Tove Fitzgerald.
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/