Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: string function


From   Grace Jessie <gracejessie@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: string function
Date   Wed, 24 Aug 2011 10:42:52 +0000

Dear statalists,
How to count how many times a substring appears in a string?
For example,
function("abcdaf","a")=2

And, how to check if a string variable has certain substrings?
With regard to this, I want to ask two functions.
For example,
function("abcdaf","a","b","c")
One of what I want to do is to return 1 if a or b or c is included in "abcdaf", ;
the other is to return 1 if a, b and c are included in "abcdaf".
Could anyone tell me the correct functions for thoes above?
Thank you
Grace
  		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index