Announcement

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

  • Exporting stata results to excel without the values getting rounded off

    When I export the stata results to excel the values are rounded off. I need the data unchanged with all the decimals. It would be a lot of help if anyone could help me with this issue.

    Thank you for your time

  • #2
    Data example please

    Comment


    • #3
      I don’t know how you are exporting results, but I can say that Stata is not rounding your values or losing precision. Rather, Excel really likes to enforce “helpful” display formats. putexcel- allows you to override these defaults, or else you can open up the Excel sheet and manually increase the displayed number of digits and see the raw values.

      Comment


      • #4
        Here is an example using -putexcel- showing what I mean.

        Code:
        putexcel set "mypi.xlsx", replace
        
        putexcel A1 = "Default format"
        putexcel B1 = (c(pi))
        
        putexcel A2 = "Using nformat"
        putexcel B2 = (c(pi)) , nformat(0.##) // NB: this is Excel-specific formatting codes
        
        putexcel save
        Note that whichever cell I select with the value of pi, the full precision of the original value exists in the cell, but Excel is using different display formats. In B1, it's the default. In B2, it's showing to 2 decimal places.

        Click image for larger version

Name:	mypi.PNG
Views:	1
Size:	9.3 KB
ID:	1704576

        Comment

        Working...
        X