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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: plot multiple vertical lines according to specific variable values


From   Francesco <cariboupad@gmx.fr>
To   statalist@hsphsun2.harvard.edu
Subject   st: plot multiple vertical lines according to specific variable values
Date   Fri, 9 Mar 2012 16:26:50 +0100

Dear Statalist,

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) ?

Many thanks,

*
*   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