Announcement

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

  • increasing the number of digits displayed in output window

    Hi there
    I have the following problem with the frequency table output attached. All of the values for CodeUC are in fact different from each other, but they are all made to look the same in the frequency table (2.50e+07). Is there a way to modify the settings to display the full values?
    Thanks
    Attached Files

  • #2
    Assign an appropriate format to CodeUC.

    Code:
    . set obs 1
    number of observations (_N) was 0, now 1
    
    . generate x = 12345670
    
    . tab x
    
              x |      Freq.     Percent        Cum.
    ------------+-----------------------------------
       1.23e+07 |          1      100.00      100.00
    ------------+-----------------------------------
          Total |          1      100.00
    
    . format x %10.0f
    
    . tab x
    
              x |      Freq.     Percent        Cum.
    ------------+-----------------------------------
       12345670 |          1      100.00      100.00
    ------------+-----------------------------------
          Total |          1      100.00

    Comment


    • #3
      Ah yes, thanks. The format was previously %12.0g, which displayed the longform number in the data editor window but not in the results window. I changed the format to %12.0f and it now displays longform in both.
      Thanks again

      Comment


      • #4
        Let me add one possibly extraneous piece of advice. It appears to me that you are storing a numeric code as a number rather than as a string. Given your choice of 12 digits for the format, if indeed you are storing codes longer than 7 digits it is imperative that they are stored in a long or double variable and not a float, as the following example demonstrates.
        Code:
        . clear
        
        . input float x double y
        
                     x           y
          1. 123456780 123456780
          2. 123456781 123456781
          3. 123456782 123456782
          4. 123456783 123456783
          5. 123456784 123456784
          6. 123456785 123456785
          7. 123456786 123456786
          8. 123456787 123456787
          9. 123456788 123456788
         10. 123456789 123456789
         11. end
        
        . format x y %12.0f
        
        . list, clean
        
                       x           y  
          1.   123456784   123456780  
          2.   123456784   123456781  
          3.   123456784   123456782  
          4.   123456784   123456783  
          5.   123456784   123456784  
          6.   123456784   123456785  
          7.   123456784   123456786  
          8.   123456784   123456787  
          9.   123456784   123456788  
         10.   123456792   123456789  
        
        .
        More information on this is in the output of help data types in the section on precision of numeric storage types.

        My apologies if you've already considered this issue, but precision issues are a common source of problems on Statalist.

        Comment


        • #5
          How do you increase the number of digits displayed. In the example below, it will be for Total.


          Click image for larger version

Name:	Screenshot 2023-10-06.png
Views:	1
Size:	3.9 KB
ID:	1729429


          Thank you.

          Comment

          Working...
          X