Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Phil Clayton <philclayton@internode.on.net> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Thread-Index: AczxXtYwD2VOTYqASdGGftzjvCHPSg== |
Date | Thu, 23 Feb 2012 00:35:35 +1100 |
Not quite sure I get what you're trying to do, but maybe something like this: --------- set up example dataset ---------- clear set obs 1000 gen byte group=trunc(4*runiform()) gen byte died=rbinomial(1, group/5) replace died=0 if group==0 -------------- end of setup --------------- ------------ result of above -------------- . tab group died | died group | 0 1 | Total -----------+----------------------+---------- 0 | 215 0 | 215 1 | 216 52 | 268 2 | 159 95 | 254 3 | 102 161 | 263 -----------+----------------------+---------- Total | 692 308 | 1,000 ------------------------------------------- ------------- draw bar graph ------------- gen byte died7d=100*(died & group==1) gen byte died30d=100*(died & group==2) gen byte died180d=100*(died & group==3) graph bar (mean) died7d died30d died180d, ascategory /// yvaroptions(relabel(1 "7 days" 2 "30 days" 3 "180 days")) /// ytitle("% mortality") ------------- end of example ------------- Phil On 22/02/2012, at 11:38 PM, Stig Lønberg Nielsen wrote: > Hi > > I am trying to produce a bar graph showing 7 day, 30 day and 180 day mortality relative to my population. I have catagorical variables for each mortality group (0 1) and a dummy variable for all of the mortality groups (1, 2, 3, .) > > My problem is that when I produce a histogram og graph bar STATA ignores my missing values and produces bars relative to only the dead patients - not the whole population. If I recode missing values as 0 a 4th graph is produced - which I do not want. > > Any help would be very much appreciated! > > > Venligst > Stig Lønberg Nielsen > Læge, ph.d. studerende > Klinisk Institut, Syddansk Universitet > Infektionsmedicinsk afdeling Q, > Odense Universitetshospital > > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/