Announcement

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

  • keep string variables that have certain number of digits

    Hello everyone!
    Could someone please help me keep the observations with 8-digit numbers? The variable is the HS product code, but I only want to keep the most disaggregated chapter (8-digit)

    product
    01
    0101
    010110
    01011010
    01011090
    010111

    Thanks in advance,
    Annette

  • #2
    Code:
    keep if strlen(product)==8
    If this doesn't work, please provide a more realistic sample of your data by using the dataex command to generate it and then pasting the output in a reply to this post.

    Comment


    • #3
      It worked perfectly! Thanks Ali Atia!

      Comment

      Working...
      X