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 |
Code:
bys failyear: gen failure =_n bys failyear age65: gen fail=_n
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)
Thanks a lot.
Shalom
0 Response to Help regarding creating variables for line + bar graph.
Post a Comment