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]

Re: st: sorting a bar chart by two variables


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: sorting a bar chart by two variables
Date   Tue, 12 Nov 2013 18:06:36 +0000

Sounds like

egen group = group(count lowestc2)

... sort(group)
Nick
[email protected]


On 12 November 2013 17:41, Likosky, Donald <[email protected]> wrote:
> Dear All,
>
> I am trying to create a bar graph and sort it by two variables.
>
> I currently am able to sort by the variable "count". I like to sort by a second variable "lowest3c2".
>
> Is that possible?
>
> Here is my current code:
>
> egen count= mean(lowest3c1), by(sitelabel)
> graph bar lowest3c2 lowest3c3, ylabel(0 "0" .2 "20".4 "40" .6 "60" .8 "80" 1 "100", angle(0)) stack over(sitelabel, label(angle(rvertical)) sort(count) descending) ytitle(Percent) title ("Normothermic or Mildly Hypothermic Cases") legend(rows(1) label(1 "Mild Hypothermia") label(2 "Normothermia") size(*.8)) note("Mild: 32.0-34.9,Normo: 35.0+")
>
> Thank you,
> Donny
>
> 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/

*
*   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