Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to filter out string observations with common characters?

    Hi Statalisters,

    I am new to Stata and when I work on my data. I want to filter out string observations with common characters. For example, as the following chart shows, the string variable name is InstituteName and it contains many observations. However, these five observations presented below have a common character "Government" thus I want filter out them with character "Government". What command should I use to deal with this problem?
    InstituteName
    US Government
    US Government
    U.S Government
    U.S Government
    U S Government

  • #2
    You can use regexm. Example with browse:
    Code:
    browse if regexm(InstituteName,"Government")

    Comment


    • #3
      Originally posted by Salvatore Lattanzio View Post
      You can use regexm. Example with browse:
      Code:
      browse if regexm(InstituteName,"Government")
      Great tips. Thanks!

      Comment

      Working...
      X