Announcement

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

  • Replace command not working

    Dear Colleagues,
    Can someone help me understand why replace command is not working for me.See below
    ------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str11(spn_serotype s1)
    "35B" "0"
    "9V"  "0"
    "34"  "0"
    "15B" "0"
    "6A"  "0"
    "15A" "0"
    "16A" "0"
    "21"  "0"
    "1"   "1"
    "1"   "1"
    "1"   "1"
    "1"   "1"
    "1"   "1"
    "1"   "1"
    "1"   "1"
    end
    ------------------ copy up to and including the previous line ------------------

    Listed 15 out of 15 observations

    . replace s1=spn_serotype if s1=="1"
    (0 real changes made)


    Regards,
    Fred Orwa

  • #2
    Actually your code worked. Just because s1 has already been identical to spn_serotype when s1 == "1", at least in your example data, no changes have been made.

    Comment

    Working...
    X