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: Selecting particular data for bar graphs


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Selecting particular data for bar graphs
Date   Wed, 12 Feb 2014 14:24:48 +0000

I am trying to work out how 1960 to 2012 implies 42 and 4 decades: no matter!

I would -reshape long- to get your 10 country rates into one variable
with -country- as an identifier. This structure will be useful for
many other Stata purposes.

Assuming then -country- -year- -rate-

gen decade = 10 * floor(year/10)

graph hbar (mean) rate, over(country) over(decade)

Personal heads-up: -graph dot- often works better than a bar chart.

Nick
[email protected]


On 12 February 2014 14:15, Gilad Isaacs <[email protected]> wrote:
> Hi,
>
> I am relatively new to Stata so hopefully this is not too elementary a question.
>
> I have a data set, it consists of 42 observations from the years 1960
> to 2012 for 10 different variables, each of which are a country. The
> data is each country's interest rate for that year.
>
> I want to create a bar graph. I want the graph to have four sets of
> bars. Each set contains a bar for each country and shows the average
> interest rate for that decade. So the first set is 1960 - 1969, and
> shows the average for each country over that period, the second set
> shows 1970 - 1979, and has one bar for each country, etc.
>
> I don't see such an option using the "graph bar" command. Should I
> create the averages separately and then graph those? If so do I need
> to create the averages in another file and then use that file?
>
> Thanks very much,
>
> Gilad Isaacs
> *
> *   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