Announcement

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

  • How to replace comma(,) with punctuation(.) for the decimal separator

    Hi Stata users,

    I am using European data, and it has punctuation for thousand separator, and comma for decimal separator. (Reverse to the U.S.)

    How can I destring it correctly?
    For example

    45,5 is indeed 45.5. But I cannot make it like this.
    Also 256.233 is indeed 256,233 in the U.S. format

    Does anyone have an idea for this?

    Best regards,
    Ed

  • #2

    The help for destring tells you about the dpcomma option which is intended for exactly this purpose.

    Comment


    • #3
      Generalizing on Nick's answer, when a command does not work as expected, the first step is to read Stata's help for the command, as recommended by Section 3 of the Statalist FAQ linked to from the top of every Statalist page.

      Comment


      • #4
        Thank you Nick and William, I would look into this.

        Comment


        • #5
          Hi Nick,
          I could do dpcomma for comma to punctuation. But I cannot still do the other way around. Punctuation to comma. Do you have any idea about this? I appreciate your help!

          Comment


          • #6
            How a variable is displayed is a consequence of the display format to the variable. If you haven't used
            Code:
            format
            to assign a display format to your numeric variable, it will have the default display format.
            Code:
            help format
            explains what you need to know.

            Comment

            Working...
            X