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: plot multiple vertical lines according to specific variable values


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: plot multiple vertical lines according to specific variable values
Date   Fri, 9 Mar 2012 15:33:06 +0000

levelsof date if special_date, local(levels)

line X date, sort xli(`levels')

Nick

On Fri, Mar 9, 2012 at 3:26 PM, Francesco <cariboupad@gmx.fr> wrote:

> I have a (simple?) question :
>
> Lets suppose I have the following dataset structure
>
> Date               X             special_date
> 01/01/2008      10           0
> 03/01/2008      12           0
> 05/01/2008      13           1
> 07/01/2008      11           0
> 10/01/2008      11           1
> 12/01/2008      14           0
> ...
>
> I would like to plot X against the date, so I type
>
> -twoway line X date, sort
>
> However I would also like to add a vertical line on my graph, EACH
> time the special_date variable is true (that is =1)
> I dont know how to do that. I know that there is the option -xline for
> creating vertical lines at specific dates values, but how to use it
> here (if appropriate) ?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index