Announcement

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

  • How to keep zero proportions at the collect table with statistic(rawproportion)

    When I do the next command I have the next result, where for priority1 = 5 and priority2 = 6 or 7 we have 0, but it is not shown. zerocounts work only with frequencies.

    collect table priority1 priority2, statistic(rawproportion) nformat(%6.3f) sformat("%s%%" percent) nototal zerocounts

    How can I put zeroes at this two positions and have table with proportions?
    Attached Files

  • #2
    Here is an example, using the auto data, for how to put "0.000" where the proprtion result is empty.
    Code:
    sysuse auto
    
    table rep78 foreign, statistic(proportion) nformat(%6.3f) nototal
    
    collect style cell result[proportion], empty(0.000)
    collect preview
    Here is the resulting table.
    Code:
    ----------------------------------------
                       |      Car origin
                       |  Domestic   Foreign
    -------------------+--------------------
    Repair record 1978 |
      1                |     0.029     0.000
      2                |     0.116     0.000
      3                |     0.391     0.043
      4                |     0.130     0.130
      5                |     0.029     0.130
    ----------------------------------------

    Comment


    • #3
      You can target specific cells if you do not want all empty proportions to show up as "0.000". Based on the informatin provided in #1, I believe the call is something like
      Code:
      collect style cell result[proportion]#priority1[5]#priority2[6 7], empty(0.000)

      Comment


      • #4
        Thank you! That works!

        Comment

        Working...
        X