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: Dates in -graph bar-


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Dates in -graph bar-
Date   Wed, 12 Jun 2013 15:25:47 +0100

I would try

gen sYear_Quarter = string(Year_Quarter, "%tq")

... , over(sYear_Quarter)

Nick
[email protected]


On 12 June 2013 13:31, STOLOWY, Herve <[email protected]> wrote:

> I have a question very similar to the one raised in:
>
> http://www.stata.com/statalist/archive/2010-04/msg00867.html
>
> I read the answer and some other threads on dates in graph
> (http://www.stata.com/statalist/archive/2011-10/msg00731.html) and do
> not find the answer for my problem.
>
> I want to make a graph with the command:
>
> graph bar Downgrade Upgrade if Crisis2 == 1, over (Year_Quarter)
>
> where Year_Quarter is formatted as  %tq. I have 8 quarters involved in
> the graphs (from 2007q1 to 2008q4).
>
> This produces a graph with the number corresponding to the quarter on
> the x-axis (from 190 to 197), rather than the actual quarter (e.g.
> '190' instead of '2007q1').
>
> How can I get the quarter to show up rather than the corresponding number?
>
> In the above mentioned thread, I read the solution. I do not
> understand why with a graph twoway, the label is by default the one I
> would like to have. With bar, it does not work by default. (But my
> graph cannot be twoway).
>
> I found the following solution:
>
> graph bar Downgrade Upgrade if Crisis2 == 1, over (Year_Quarter,
> relabel (1 "2007q1" 2 "2007q2" ... 8 "2008q4")).
>
> It works by it is painful. I was not able to use -mylabels-
> downloadable from ssc) to generate automatically the "relabel".
*
*   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