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: Question about graph bar
From
Steven Samuels <[email protected]>
To
[email protected]
Subject
Re: st: Question about graph bar
Date
Wed, 3 Aug 2011 17:36:34 -0400
Rachel, you will find graphing easier if you spell our favorite program's name correctly. It is "Stata" (see the last section of the FAQ). In the programs SAS, SPSS, and SUDAAN, the letters in the name originally stood for other words (e.g. SAS = "Statistical Analysis System"); in other words, they are acronyms. That's not true of Stata, so its name should not be capitalized.
Steve
On Aug 3, 2011, at 5:19 PM, O'Brien, Rachel H wrote:
Thanks for the help! I have always used Excel for graphs in the past, so graphing in STATA is very foreign to me.
Rachel
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alan Neustadtl
Sent: Thursday, July 28, 2011 2:06 PM
To: [email protected]
Subject: Re: st: Question about graph bar
Here is a way to create a variable that you can graph -over- and then
use the sort suboption. Compare the two bar graphs created by the
fopllowing code:
/* Create small dataset */
clear *
set obs 100
generate x3=10+int((20-10+1)*runiform())
generate x1=30+int((40-30+1)*runiform())
generate x2=70+int((90-70+1)*runiform())
/* Use stack to create an "over" variable & graph */
preserve
stack x1 x2 x3, into(x) clear
graph bar x, over(_stack) name(g1, replace)
graph bar x, over(_stack, sort(1)) name(g2, replace)
restore
Best,
Alan
On Thu, Jul 28, 2011 at 4:32 PM, O'Brien, Rachel H
<[email protected]> wrote:
> Hi. I am trying to create a bar graph for the means of 10 different variables. Each variable is an indicator for whether or not the survey respondent answered yes to a question (and the respondent could have said yes to multiple questions). I would like STATA to order the bars (variables) by the mean (most frequent --> least frequent). Is there an option or anything that will do this? I know I can do this manually by ordering the variables in the graph bar command based on their means, but I thought I would check if there is a more automatic way.
>
> Thanks!
>
> Rachel O'Brien
>
> *
> * 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/
*
* 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/