Announcement

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

  • Identify observations of string variable with a specific pair of characters

    I want to identify those observations of the string variable (x), which contain pair of characters "abs" and "def", anywhere in the string.

    E.g. I want to identify the observation if x == "he walked to def and abs later" but not if x == "he walked to def and kkk later" (because I want both "abs" and "def" to be there. How can I do this? So far, I have used strpos().

    Code:
    tab y if strpos(lower(y), "abs")
    Many thanks,
    Mihir

  • #2
    Code:
    tab y if strpos(lower(y), "abs") & strpos(lower(y), "def")

    Comment


    • #3
      thank you! sorry- that was a silly question in hindsight!

      Comment

      Working...
      X