Announcement

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

  • How to double quote the double quote

    Dear Stata users,

    I have a string variable that some values of it are leading by a double quote ("). I want to trim the leading double quote using -subinstr()- function. However, I find that I cannot quote the (") in double quote ("").

    Code:
    replace name=subinstr(name,""","",1)
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str10 name
    "John"    
    `""Lee"'  
    "Richard"  
    `""Smith"'
    `""Alfred"'
    "Grusky"  
    end

  • #2
    The -dataex- result has provided me hints. I should use compound double quotes.
    Code:
    replace name=subinstr(name,`"""',"",`)

    Comment

    Working...
    X