Announcement

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

  • How to avoid scientific notation when displaying values

    I would like to know the total number of non-missing observations as well as the number of distinct values for each variable below. How can I avoid scientific notation when doing so?

    Code:
    . distinct n_aih cnes mun_cnes proc proc_sol cid_pri cid_sec cid_asso cid_morte
    
               |        Observations
               |      total   distinct
    -----------+----------------------
         n_aih |   1.01e+08   1.01e+08
          cnes |   1.01e+08       6045
      mun_cnes |   1.01e+08       3574
          proc |   1.01e+08       1877
      proc_sol |   1.01e+08       1882
       cid_pri |   1.01e+08       1998
       cid_sec |   1.05e+07       2040
      cid_asso |     868589       1980
     cid_morte |    2852869       1893
    
    . 
    end of do-file
    
    .

  • #2
    Unless Nick Cox (the author of the distinct command available from the Stata Journal as package dm0042_1) can suggest an alterenative, I think you're going to have to edit the distinct.ado flie, first dropping any current copy in memory so that the next time you run the command a new copy will be loaded from the edited file.
    Code:
    program drop distinct
    doedit `"`c(sysdir_plus)'/d/distinct.ado"'
    will open distinct.ado in a Do-file Editor window. Scroll down to
    Code:
                    " {c |}  " as res %9.0g r(N) "  " %9.0g r(sum)
    and replace the two formats %9.0g with something like %16.0fc and then save the edited do-file.

    Comment


    • #3
      Paula is missing the need to explain where community-contributed commands come from (FAQ Advice #`12). It seems that she is using an out-of-date version of distinct (written by Gary Longton and myself).

      As a twist on @William Lisowski's point, check out the latest version first: :


      Code:
      SJ-15-3 dm0042_2  . . . . . . . . . . . . . . . . Software update for distinct
              (help distinct if installed)  . . . . . .  N. J. Cox and G. M. Longton
              Q3/15   SJ 15(3):899
              improved table format and display of large numbers of
              observations

      Comment

      Working...
      X