Announcement

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

  • T&E

    Hi I am trying to create a stacked bar graph using the percentage option but one of the bars is greater than 100. I think it is a rounding error but I cannot work out how to resolve the issue.

    Sample of the dataset.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(ContractTotal AContract BContract CContract DContract Aprpn x)
        3067     3067         0       0   0        1 60
    14638.93 14372.93       263       3   0 .9818293 61
    10025.02  8573.54   1384.49   66.99   0 .8552142 62
    19532.23 16652.24 303.33002 2576.66   0 .8525519 63
        5470     5470         0       0   0        1 64
       12962    12962         0       0   0        1 65
     13554.5  13554.5         0       0   0        1 66
         176      176         0       0   0        1 67
        1691     1380         0       0 311 .8160852 68
        5399     4431         0       0 968 .8207076 69
        3516     3480         0      36   0 .9897611 70
    end
    This is the stacked graph I am trying to create. The problem is with observation x=61

    Code:
    graph bar (asis) AContract BContract CContract DContract ///
    , over(x, gap(-2) sort(Aprpn) lab(nolabel)) percentage stack ytitle("Percentages") ///
    title("Proportion of Hours across Departments") ///
    bar(1, color(dknavy) ) ///
    bar(2, color(green)) bar(3, color(red) ) ///bar(4, color(black) )
    Attached Files
Working...
X