Announcement

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

  • Replacing float numbers of a given variable

    Dear Stata Users,

    Can you please help me to set the numbers inside the variables in a following format - "x.yz". For instance, in the dataset below I want to have numbers in variables "b" and "c" in a following format:

    b c
    0.91 0.00
    1.6 0.00
    2.28 10.00
    2.74 25.00
    5.25 8.70


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str40 main_var float(a b c)
    "aa"  4  .91   0
    "bb"  7  1.6   0
    "cc" 10 2.28  10
    "dd" 12 2.74  25
    "ee" 23 5.25 8.7
    end

  • #2
    Code:
    format c %3.2f

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X