Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Stacked bar chart with twoway


From   "Likosky, Donald" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Stacked bar chart with twoway
Date   Fri, 1 Nov 2013 15:37:42 +0000

I am trying to produce a stacked bar chart with the twoway command.

The goal is to display differences in the proportion of two variables (trbc= _post_centername trbc_intra_centername ) for each of 70 hospitals. The hosp= itals would be on the x-axis, and the y-axis would be displaying proportion= s. I would like to display the graph as stacked bar chart for each medical = center. The code below color codes which hospital belongs to a particular g= roup (there are 4 groups with values of 1, 2, 3, 4).

The code doesn't appear to work. I receive the following error:
option stack not allowed
r(198);

Any ideas would be much appreciated.

sort trbc_intra_centername
twoway ( ///
bar trbc_post_centername trbc_intra_centername if region_label=3D=3D1, stac= k percent fcolor(red) lcolor(red))) /// bar trbc_post_centername trbc_intra_centername if region_label=3D=3D2, stac= k percent fcolor(blue) lcolor(blue)) /// bar trbc_post_centername trbc_intra_centername if region_label=3D=3D3, stac= k percent fcolor(green) lcolor(green)) /// bar trbc_post_centername trbc_intra_centername if region_label=3D=3D4, stac= k percent fcolor(chocolate) lcolor(chocolate))) /// , ylabel(0(20)100, angle(horizontal)) ytitle(Percent) xtitle(Medical Center=
) title("Timing of Transfused Units" "by Medical Center" "AVR+/-CABG Surger=
y") legend(on order(1 "Group 1" 2 "Group 2" 3 "Group 3" 4 "Group 4"))


Donald S. Likosky, Ph.D.
Associate Professor
Section Head, Section of Health Services Research and Quality Department of Cardiac Surgery The Center for Healthcare Outcomes & Policy (CHOP) University of Michigan Medical School Ann Arbor, MI 48109
Email: [email protected]<mailto:[email protected]>
Tele: 734-232-4216 (M-Th), 734-615-3674 (F)

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues 


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index