Announcement

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

  • searching a string variable for a paired string of digits

    I have two variables - one is hexadecimal and looks like this

    000000004ebadb55ee9096c9a2f8880e09da59c0d68b1c228d a88e48844a1485

    and the other is a sequence of 6 digits ranging between 100,000 and 500,000.

    The two variables are pairs – I'm looking to see if the digit sequence appears within the paired hexadecimal sequence. I'm not looking to see if a given 6-digit sequence appears in ANY of hexadecimals, but whether a given 6-digit sequence appears in its OWN hexadecimal counterpart. I've attached a snippet of the data.

    Any help appreciated.
    Attached Files

  • #2
    first, do not post data in spreadsheet format; not only do some of us not own excel, but many are leary of binary files from strangers - please read the FAQ on how to post some example data

    second, I think the following will do (use your real variable names, not the var1 and var2 that I use) - note that the following assumes that each of your variables is a string variable (us -tostring-if not true):
    Code:
    gen byte dummy = strpos(var1,var2)>0

    Comment


    • #3
      Thank you so much for the help, Rich. That worked perfectly. My apologies about the data snippet. Will pay more attention to the rules in the future.

      Comment

      Working...
      X