Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Dates in -graph bar-


From   "STOLOWY, Herve" <stolowy@hec.fr>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Dates in -graph bar-
Date   Wed, 12 Jun 2013 17:16:43 +0200

Dear Nick:

It works perfectly fine.

Once again, I thank you very much.

Hervé


On Wed, Jun 12, 2013 at 4:25 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> I would try
>
> gen sYear_Quarter = string(Year_Quarter, "%tq")
>
> ... , over(sYear_Quarter)
>
> Nick
> njcoxstata@gmail.com
>
>
> On 12 June 2013 13:31, STOLOWY, Herve <stolowy@hec.fr> 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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index