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: Re: kdensity of a date
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Re: kdensity of a date
Date
Fri, 28 Mar 2014 18:26:11 +0000
Works for me. I have to work a bit at getting _nice_ dates, but there you go.
local dates
clear
set obs 100
set seed 2803
gen mydate = round(rnormal(19000, 100))
forval i = 2011/2012 {
local dates `dates' `=mdy(1,1,`i')' `=mdy(7,1,`i')'
}
kdensity mydate, xla(`dates', format(%td_d_m_CY))
See also
http://www.stata-journal.com/sjpdf.html?articlenum=gr0030
where the whole small thing is discussed in excruciating detail.
Nick
[email protected]
On 28 March 2014 16:54, Pietro Biroli <[email protected]> wrote:
> Dear All,
>
> I want to draw a kdensity plot of a date variable, but when I do so
> the x-axis shows only numbers and not the appropriate date format
> (%td).
>
> I have a variable called Date that stores the day when an event
> occurred. The display format of the variable is %td, so that when I
> -browse Date-, -tab Date-, or even -histogram Date- I see something
> like 22Nov2013.
>
> However when I use the kdensity command, on the x-axis I see only a
> number, notably, the number of days since 01jan1960. I tried to use
> some options like ", format" or ", range()" but they are not accepted.
>
> can anybody help?
> Thanks
> Pietro
> *
> * 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/