Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: string comparision

From   tashi lama <[email protected]>
To   <[email protected]>
Subject   st: string comparision
Date   Mon, 30 Jul 2012 20:24:02 +0000

Is there a direct way of listing variables matching all of the some of the strings, similar to sql functions "like" and "rlike" ? Here is my dataset say,

ID    Name 
1     John Malda 
2     Sam Houston 

I would like to list Name var matching full or part of the string something like following

list if Name like "Jo"

I searched for previous posts related to above question and found some of the string-matching functions/commands like strgroup, reclink and strmatch. I can picture using strmatch to solve my problem but that wouldn't be direct in the sense, I will have to use loops and may be create indicator  variables to get my job done. But again, I can only picture at this point. Any folks know any direct and better options? 

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index