Announcement

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

  • Stata 18: Error in FORMAT command

    Hi,

    When I format the numbers from 0.5 to <0.6 (e.g. 0.5, 0.5236, whether generated as float or double) with %9.0f in Stata 17, the number 1 is displayed.

    In contrast, in Stata 18: 0 (zero)

    Do you have any explanation for this?

  • #2
    This isn't (obviously) an error in the format command, but I can confirm getting this; I too regard it as an error and have no explanation.

    Comment


    • #3
      Nick Cox Thank you for your confirmation!


      StataCorp, please correct the error or explain how to avoid it.
      (still with the command format, not with round)

      Thank you!

      Comment


      • #4
        I confirm that the interpretation of %#.0f appears to have changed. You cannot get old behavior under version control. I agree that this is probably a bug.

        Code:
        about
        display %9.0f 0.5236
        version 17 : display %9.0f 0.5236
        Code:
        . about
        
        Stata/BE 18.0 for Windows (64-bit x86-64)
        Revision 15 Nov 2023
        Copyright 1985-2023 StataCorp LLC
        
        Total physical memory:       16.00 GB
        Available physical memory:    8.30 GB
        
        Stata license: Single-user  perpetual
        Serial number: omitted
          Licensed to: daniel klein
                       DZHW
        
        . display %9.0f 0.5236
                0
        
        . version 17 : display %9.0f 0.5236
                0

        Code:
        . about
        
        Stata/BE 17.0 for Windows (64-bit x86-64)
        Revision 14 Nov 2023
        Copyright 1985-2021 StataCorp LLC
        
        Total physical memory:       16.00 GB
        Available physical memory:    8.29 GB
        
        Stata license: Single-user  perpetual
        Serial number: omitted
          Licensed to: daniel klein
                       DZHW
        
        . display %9.0f 0.5236
                1
        
        . version 17 : display %9.0f 0.5236
                1

        Comment


        • #5
          Thank you for bringing this to our attention. This issue is due to a bug in the version of the Microsoft SDK that we use build Stata 18. This issue only affects Stata 18 and only on Windows. There is a patched SDK available and we have upgraded our build environment to address the issue. Look for the fix in the next executable update.

          Comment

          Working...
          X