HI,

I know that this has been discussed earlier in numerous fora, but, somehow I am unable to figure out if a) this is right and b) is there a simpler less cluttered and confusing way to do this? So initial dataset includes all the subjects with the concerned event. I want to create a bar graph showing absolute numbers by calendar year which is not a problem
Year age65
1995 0
1995 0
1995 1
1997 0
1997 1
1997 0
1997 1
1997 0
1997 1
Age65 is a categorical variable indicating if age greater than or lesser than 65 years. Now to the bar graph mentioned above I need line graph in the same bargraph showing % of the >65 years which had events that year. So I need to now make the total events by calendar year and then I need to create events by age group. I wrote:
Code:
bys failyear: gen failure =_n
bys failyear age65: gen fail=_n
This is giving me counts of total events per calendar year and among each age category by calendar year.
Now how do I get the proportion of failures in age65==1 out of total failures per calendar year and then use it to make a line showing percentage of events in that age group in the bar graph which shows total events?

While I tried:
Code:
replace failure=sum(failure)
replace fail=sum(fail)
I am not totally convinced that my method is right and would appreciate some help on this.
Thanks a lot.

Shalom