Announcement

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

  • How to remove the quotation and string characters from string.

    Click image for larger version

Name:	subinstr.jpg
Views:	1
Size:	36.0 KB
ID:	1465985


    How to remove the quotation and string characters from a string?
    I would like remove the "flavor": in v6 and get the number after that.
    The code gen Flavor = subinstr(v6,`"userId":", "", .) doesn't work.

    Thanks.

  • #2
    Please note from Statalist FAQ Advice #12 that screenshots are less helpful than you might hope. Please use dataex as explained there. Your example would be solved by


    Code:
     gen wanted = real(substr(var1, 1 + strpos(var1, ":"), .))
    so you look for the colon : and take off what follows, converting it to numeric.

    Comment

    Working...
    X