Announcement

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

  • Large numbers in Stata

    Hi, my observation IDs are all in this form: 1.01e+07, all hundreds of them.
    Is there any formula so that I could turn them back into normal digits? 10101001, 10101003, 10101005, and so on....

    Thanks

  • #2
    I mean, they show in the top right corner (image) like this below, but not in the column.

    Click image for larger version

Name:	hhi1 thing.png
Views:	1
Size:	2.3 KB
ID:	1467813

    Comment


    • #3
      You may format the variable (example: format myvar %10.2f).

      That being said, considering they are IDs, I believe you'd better import ithe variable as string. If this is not possible, you may change it to string by using this - aptly named - command: tostring

      Please see the example below:

      Code:
      . input newvar
      
              newvar
        1. 1.01e+07
        2. end
      
      . gen newvar2 = newvar
      
      . format newvar2 %10.0f
      
      . tostring newvar, gen(newvar3)
      newvar3 generated as str8
      
      . list
      
           +--------------------------------+
           |   newvar    newvar3    newvar2 |
           |--------------------------------|
        1. | 1.01e+07   10100000   10100000 |
           +--------------------------------+
      To end, please take a look at the term "scientific notation" and get informed about what this sort of notation really conveys.
      Last edited by Marcos Almeida; 27 Oct 2018, 17:51.
      Best regards,

      Marcos

      Comment


      • #4
        A screenshot of the data editor is helpful but not as helpful as would be a direct data example.

        Please do read and act on FAQ Advice #12 and use dataex to show data examples.

        At worst, if you imported the variable as float, then you may have lost crucial detail on import which can be fixed only be reading in the data more carefully.

        At best, as Marcos Almeida explains, you just need to assign a more appropriate display format, except that I would recommend
        Code:
        %8.0f
        in your case.

        Code:
        help format
        Last edited by Nick Cox; 28 Oct 2018, 05:01.

        Comment

        Working...
        X