Announcement

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

  • Destringing values with multiple dots

    Hi, I want to destring a variable where some observations are by mistake coded with multiple dots like 1.999.645.000. I dont want to keep values like this but to replace them with just dot so I can then proceed to destring the variable.

    I tried to use the following code:

    Code:
    replace data ="." if strpos(data, ".000.")!=0
    replace data ="." if strpos(data, ".999.")!=0
    because many of these nonsense variables have .000. or .999. somewhere in them but not all of them. Any advice on how I could drop an observation if there are more than two dots in it or something which would help?

    Thanks in advance for any suggestions.

  • #2
    Try this:
    Code:
    replace data = "." if strmatch(data, "*.*.*")

    Comment

    Working...
    X