My question is two part. Does the problem with formatting dates on bar charts still exist and if so why isn't my workaround working?
First, I generate a bar graph over a variable that is a date (months). The date labels appear as integers, in my case running from 606 (July, 2010) to 648 (January, 2014). Here is the command
graph bar (mean) h0 (mean) myfailure, over(OBS_DATE, label(alternate labsize(tiny) format(%tm) ))
I read this message by Nick
http://www.stata.com/statalist/archi.../msg01119.html
Is it still the case that there isn't any direct way to get the dates to format correctly on bar graphs?
If that is true then my understanding is that the work around is something like this
graph bar (mean) h0, over(OBS_DATE, relabel(1 "07/10" 2 "08/10" ... 42 "12/13" 43 "01/14") label(alternate labsize(tiny) format(%tm) ))
notice the ellipse in the arguments for the relabel command. When I type full list in directly it works. However, it ends up being very long. Also it changes each month, so I would like to automate the generation of some sort of local so I can write
graph bar (mean) h0, over(OBS_DATE, relabel(`my_date_labels') label(alternate labsize(tiny) format(%tm) ))
I feel like I am close but the nesting quotes is killing me. I run the following
forvalues i = 606/648 {
local tmp: display %tmNN/YY `i'
local tmp1 `""`tmp'""'
display `"`tmp1'"'
local j = `i' - 605
display "`j'"
local tmp2 `j' " " `"`tmp4'"' " "
display `tmp2'
local my_date_labels `my_date_labels' `tmp2'
display `my_date_labels'
}
and my_date_labels looks like 1 "07/10" 2 "08/10" ... 42 "12/13" 43 "01/14" which I think is what I want
but then the graph command produces
option labels() incorrectly specified
expects, # "label" # label ... r(198);
Are there extra quotes I can't see because they are getting stripped off by the Display command? Something else wrong?
Any help is appreciated,
Caleb
First, I generate a bar graph over a variable that is a date (months). The date labels appear as integers, in my case running from 606 (July, 2010) to 648 (January, 2014). Here is the command
graph bar (mean) h0 (mean) myfailure, over(OBS_DATE, label(alternate labsize(tiny) format(%tm) ))
I read this message by Nick
http://www.stata.com/statalist/archi.../msg01119.html
Is it still the case that there isn't any direct way to get the dates to format correctly on bar graphs?
If that is true then my understanding is that the work around is something like this
graph bar (mean) h0, over(OBS_DATE, relabel(1 "07/10" 2 "08/10" ... 42 "12/13" 43 "01/14") label(alternate labsize(tiny) format(%tm) ))
notice the ellipse in the arguments for the relabel command. When I type full list in directly it works. However, it ends up being very long. Also it changes each month, so I would like to automate the generation of some sort of local so I can write
graph bar (mean) h0, over(OBS_DATE, relabel(`my_date_labels') label(alternate labsize(tiny) format(%tm) ))
I feel like I am close but the nesting quotes is killing me. I run the following
forvalues i = 606/648 {
local tmp: display %tmNN/YY `i'
local tmp1 `""`tmp'""'
display `"`tmp1'"'
local j = `i' - 605
display "`j'"
local tmp2 `j' " " `"`tmp4'"' " "
display `tmp2'
local my_date_labels `my_date_labels' `tmp2'
display `my_date_labels'
}
and my_date_labels looks like 1 "07/10" 2 "08/10" ... 42 "12/13" 43 "01/14" which I think is what I want
but then the graph command produces
option labels() incorrectly specified
expects, # "label" # label ... r(198);
Are there extra quotes I can't see because they are getting stripped off by the Display command? Something else wrong?
Any help is appreciated,
Caleb
Comment