Announcement

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

  • bar chart for actual numbers (not summary statistics)

    hello,
    I am using a case-control study design to examine rates of attendance to health care over a five years period for a binary outcome (disease yes/no). I have collected data from electronic health records over total frequencies per year; hence I ended up with five columns (one for each year). I would like to demonstrate those rates in one bar graph for cases/control/total over time. To be able to have all time periods in one graph, I manually calculated the rates and reformed a dataset as follows:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(year disease rate)
    5 0  70
    5 1  80
    4 0  50
    4 1  70
    3 0  40
    3 1  60
    2 0  45
    2 1  90
    1 0  50
    1 1 100
    end
    then I run those syntaxes:

    seperate rate, by(disease)
    gen totalrate= rate
    but I don't know how to proceed.
    If I use this syntax:

    graph bar (count) totalrate rate1 rate0, over(year)
    it does not work at all because it is a "count". I have already done the count and calculated the rate.
    I would like a bar chart:
    *with calculated attendance rates on the y-axis
    *with years (starting from 5 to 1) on the x-axis
    *to include cases, control and total.

    How is that possible? Your help is much appreciated.

    Danah
Working...
X